Skip to content

Instantly share code, notes, and snippets.

@simudream
Created November 27, 2014 00:37
Show Gist options
  • Save simudream/9cdfb6201aac62f58343 to your computer and use it in GitHub Desktop.
Save simudream/9cdfb6201aac62f58343 to your computer and use it in GitHub Desktop.
Nonsense 1
t=0
cvs=document.createElement "canvas"
document.body.appendChild cvs
ctx=cvs.getContext "2d"
cvs.width=window.innerWidth
cvs.height=window.innerHeight
raf=requestAnimationFrame
db=(x,y,v) ->
p=(x*y)/4096
pv=(v-80)/40
ctx.fillStyle="rgb(#{parseInt (1-pv)*255},#{parseInt pv*255},#{parseInt (0.5-pv)*255})"
ctx.fillRect parseInt(x*10-parseInt(-window.innerWidth,10)/64*y+window.innerWidth/2+parseInt(-window.innerWidth*1.2,10),10),parseInt(y-v+Math.cos(t/3)*parseInt(window.innerHeight/3,10)/64*x+window.innerHeight/2,10),10,Math.pow(v,1.1)
return
raf r=->
t+=0.1
ctx.fillStyle="#000"
ctx.fillRect 0,0,window.innerWidth,window.innerHeight
for x in [0..64] then for y in [0..64] then db x,y,Math.sin(x*y/4096*Math.PI*10/2+t)*20+100
raf r
body { overflow: hidden; background: black }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment