// two meshing gears turning against each other, the small one spinning faster // the small gear's angle comes from rolling contact, offset half a tooth so its gap meets the big gear's tooth const{sin,cos,PI}=Math,T=2*PI export const frames=16,delay=70 const gear=(c,x,y,n,R,th,holes)=>{ const p=T/n,ri=R-10,ro=R+8 c.beginPath() for(let k=0;k{ const N=12,n=8,m=11,R=N*m/2,r=n*m/2,f=-.6,bx=90,by=158,sx=bx+(R+r)*cos(f),sy=by+(R+r)*sin(f) const tb=t*T/6,ts=f+PI+PI/n-(N/n)*(tb-f) gear(c,bx,by,N,R,tb,6) gear(c,sx,sy,n,r,ts,0) }