Skip to content

Instantly share code, notes, and snippets.

@drcircuit
Created April 19, 2025 21:08
Show Gist options
  • Select an option

  • Save drcircuit/fd70771469647766404956d9e3bdd34a to your computer and use it in GitHub Desktop.

Select an option

Save drcircuit/fd70771469647766404956d9e3bdd34a to your computer and use it in GitHub Desktop.
<canvas><script>for(g=150,c=document,c.bgColor=0,d=c.body.lastChild,e=d.getContext("2d"),q=[],R=Math.random,m=g;m--;)q[m]={x:0,y:0,z:R()*g};setInterval(t=>{for(e.reset(),i=0;i<g;i++)s=q[i],s.z-=2,s.z<=0&&(s.z=g,s.x=R()*g,s.y=R()*g),k=g/s.z,x=(s.x-g/2)*k+g/2,y=(s.y-g/2)*k+g/2,x>0&x<g&y>0&y<g&(c=g-g*s.z/g,e.fillStyle="rgb("+[c,c,c],e.fillRect(x,y,3,3))})</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment