// battery charging up bar by bar from red to green, sparks running down the cable, happy when full const{sin,cos,PI,floor,max}=Math,T=2*PI export const frames=25,delay=110 const LV=['#ff6b6b','#ffa94d','#ffd43b','#51cf66'],CB='#495057' export default(c,t)=>{ const n=floor(t*5),full=n>=4,col=LV[max(0,n-1)] for(const[w,st]of[[14,'#111'],[6,'#ced4da']])c.lineWidth=w,c.strokeStyle=st,c.beginPath(),c.moveTo(0,200),c.bezierCurveTo(30,200,10,128,36,128),c.stroke() if(!full)for(let k=0;k<3;k++){const p=(t*3+k/3)%1,u=p,x=(1-u)**3*0+3*(1-u)**2*u*30+3*(1-u)*u*u*10+u**3*36,y=(1-u)**3*200+3*(1-u)**2*u*200+3*(1-u)*u*u*128+u**3*128;c.fillStyle='#ffd43b';c.lineWidth=3;c.strokeStyle='#111';c.beginPath();c.arc(x,y,4,0,T);c.fill();c.stroke()} c.strokeStyle='#111';c.lineWidth=7 c.fillStyle=CB;c.beginPath();c.roundRect(30,114,16,28,4);c.fill();c.stroke() c.fillStyle='#fff';c.beginPath();c.roundRect(46,72,160,112,20);c.fill();c.stroke() c.fillStyle='#ced4da';c.beginPath();c.roundRect(206,106,18,44,6);c.fill();c.stroke() c.lineWidth=5;for(let k=0;k<4;k++)if(k