Skip to content

Instantly share code, notes, and snippets.

@veeenu
Created February 9, 2015 19:53
Show Gist options
  • Save veeenu/ace9b5ec2b1f6e56549e to your computer and use it in GitHub Desktop.
Save veeenu/ace9b5ec2b1f6e56549e to your computer and use it in GitHub Desktop.
Avgvri Rvdi - happy birthday demo card
c = document.createElement('canvas');
c.width=innerWidth;c.height=innerHeight;
document.body.appendChild(c);
d = c.getContext('2d');
d.font='64px\x20Times\x20New\x20Roman';
d.shadowColor='white'
d.shadowBlur=8;
p = []
setInterval(function() {
p.push([ Math.random()*innerWidth, Math.random()*innerHeight,
Math.random() > .5 ? -1:1, -5,
Math.random() > 0.5 ? '\x41\x56\x47\x56\x52\x49' : '\x52\x56\x44\x49']);
}, 250);
setInterval(function() {
for(i in p) {
p[i][0] += 0.25 * p[i][2];
p[i][1] += p[i][3];
p[i][3] = p[i][3] + 0.0625;
d.fillText(p[i][4], p[i][0],p[i][1]);
}
}, 1/60);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment