JSFiddle - React, Tailwind, and code Playground

by Andrew Maxwell

HTML

<canvas id="C">

JavaScript

M=Math,R=M.random,T=C.getContext("2d"),W=C.width=innerWidth,H=C.height=innerHeight,B=[{x:0,y:0,r:k=1,a:0,s:F=0}],T.lineWidth=.2;setInterval("T.beginPath(T.fillStyle=\"hsl(\"+F/5+\",99%,80%)\");for(i=k;a=B[--i];){r=25*(t=a.r-=a.s);if(r<1)B[i]=B[--k];else T.moveTo(r+(x=a.x+=M.cos(n=a.a+=(R()-.5)/9/t)),y=a.y+=M.sin(n)),T.rect(x,y,r,r),a.x=x<-r?W+r:x>W+r?-r:x,a.y=y<-r?H+r:y>H+r?-r:y,k<1e3&&R()<.02?B[k++]={x:x,y:y,r:t,a:n,s:.01/(2+R()*9)}:0}T.fill();T.stroke(++F%15?0:T.fillRect(0,0,W,H,T.fillStyle=\"hsla(0,0%,99%,.01)\"))",20)