fractal in a tweet

node v10.24.1
version: master
endpointsharetweet
F=()=>{ c=v.getContext('2d') c.lineWidth=.03 C=[1,-.5,-.5] S=[0,.87,-.87] P=[[X=200,Y=200],[X,Y],[X,Y]] R=()=>{d=parseInt(Math.random()*3) P=P.map(([x,y],i)=>(c.moveTo(x,y),c.lineTo(X=x+3*C[I=(d+i)%3],Y=y+3*S[I]),[X,Y])) c.stroke() setTimeout(R,17) } R()} `<canvas width=400 height=400 id="v"></canvas><script>(${F.toString()})()</script>`
Loading…

no comments

    sign in to comment