Skip to content

Instantly share code, notes, and snippets.

@xNWDD
Created March 23, 2017 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xNWDD/62c1f6c532f0d1f95d1bf74a6b0e4c71 to your computer and use it in GitHub Desktop.
Save xNWDD/62c1f6c532f0d1f95d1bf74a6b0e4c71 to your computer and use it in GitHub Desktop.
/*********************************************
* Si no hay punto y coma *
* *
* t(ツ) *
* *
*No tienes que ponerlo en una línea separada *
**********************************************/
function magic(balls,radius,dir,oX,oY,sX,sY,ct){ (function magic(x=0,y=0,last=-1,total=0){ if(total!=balls) return ((x,y)=>{ ((v)=>function rec(n,...args){return v[n].apply(v,args),rec})(ct)("beginPath")("arc",oX+(dir?x:y),oY+(dir?y:x),radius,0,2*Math.PI)("fill") })(x*(radius*sX)-(y*radius),y*(radius*sY)), (x>last)?magic(0,y+1,x,total+1):magic(x+1,y,last,total+1) })() }
setInterval(((i=10)=>()=>{ magic(++i%37,10,true,100,100,2,1.6666,Object.assign(document.getElementById('cv'),{width:1000}).getContext('2d')) })(),20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment