- Author:
- Jason
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- Compo:
- classic
- Demo link:
- https://js1k.com/2012-love/demo/1044
- Shortlink:
- https://js1k.com/1044
- Blog post:
- please update here!
- Bytes:
- 562
- Chars:
- 560
- Submission
var w=window.innerWidth,h=window.innerHeight,d=0,hrts=[],r=Math.random,m=Math.floor
c.width=w
c.height=h
function z(hrt,v,col){
hrt.z-=.5
a.save()
a.fillStyle=hrt.c
a.font=200/hrt.z+"px Arial"
a.fillText('♥',hrt.x,hrt.y)
a.restore()
if(hrt.z<1){col[v]=nH();}}
function nH(){
return{x:r()*w,y:r()*h,z:r()*100+75,c:'rgb('+m(r()*100+100)+','+m(r()*100)+','+m(r()*100)+')'}}
setInterval(function(){
d+=0.1
if(Date.now()%5==0&&hrts.length<200){hrts.push(nH())}
a.clearRect(0,0,w,h)
a.fillStyle="#112233"
a.fillRect(0,0,w,h)
hrts.forEach(z)
},30)
- Description
- Fly through space where the stars are hearts!
- Base64 encoded
dmFyIHc9d2luZG93LmlubmVyV2lkdGgsaD13aW5kb3cuaW5uZXJIZWlnaHQsZD0wLGhydHM9W10scj1NYXRoLnJhbmRvbSxtPU1hdGguZmxvb3INCmMud2lkdGg9dw0KYy5oZWlnaHQ9aA0KZnVuY3Rpb24geihocnQsdixjb2wpew0KaHJ0LnotPS41DQphLnNhdmUoKQ0KYS5maWxsU3R5bGU9aHJ0LmMNCmEuZm9udD0yMDAvaHJ0LnorInB4IEFyaWFsIg0KYS5maWxsVGV4dCgn4pmlJyxocnQueCxocnQueSkNCmEucmVzdG9yZSgpDQppZihocnQuejwxKXtjb2xbdl09bkgoKTt9fQ0KZnVuY3Rpb24gbkgoKXsNCnJldHVybnt4OnIoKSp3LHk6cigpKmgsejpyKCkqMTAwKzc1LGM6J3JnYignK20ocigpKjEwMCsxMDApKycsJyttKHIoKSoxMDApKycsJyttKHIoKSoxMDApKycpJ319DQpzZXRJbnRlcnZhbChmdW5jdGlvbigpew0KZCs9MC4xDQppZihEYXRlLm5vdygpJTU9PTAmJmhydHMubGVuZ3RoPDIwMCl7aHJ0cy5wdXNoKG5IKCkpfQ0KYS5jbGVhclJlY3QoMCwwLHcsaCkNCmEuZmlsbFN0eWxlPSIjMTEyMjMzIg0KYS5maWxsUmVjdCgwLDAsdyxoKQ0KaHJ0cy5mb3JFYWNoKHopDQp9LDMwKQ==
- Original source
var w=window.innerWidth,h=window.innerHeight,d=0,hrts=[],r=Math.random,m=Math.floor;
c.width = w;
c.height = h;
function z(hrt,v,col) {
hrt.z-=.5;
a.save();
a.fillStyle = hrt.c;
a.font = 200/hrt.z+"px Arial"
a.fillText('♥',hrt.x,hrt.y);
a.restore();
if(hrt.z < 1){col[v]=nH();}
}
function nH() {
return {x:r()*w,y:r()*h,z:r()*100+75,c:'rgb('+m(r()*100+100)+','+m(r()*100)+','+m(r()*100)+')'};
}
setInterval(function(){
d += 0.1;
if(Date.now()%5 ==0 && hrts.length<200){hrts.push(nH())}
a.clearRect(0,0,w,h);
a.fillStyle = "#112233";
a.fillRect(0,0,w,h);
hrts.forEach(z);
},30);