let steps = 3; console.clear(); const rules = { "A": "+BF-AFA-FB+", "B": "-AF+BFB+FA-", }; steps = Math.min(steps,5); // make sure I don't type a huge number that crashes my PC let s = "A"; for(let i=0;i { const now = new Date(); const midnight = new Date(now.getFullYear(),now.getMonth(),now.getDate()); const dt = (new Date() - midnight) / period / (60**(1-i)); const m = dt % (2*segments); const t = i == 0 ? m : (Math.floor(m) + easeInOutSine(m % 1)); // linear for big hand, eased for small hand const a = t/segments; // between 0 and 2 const b = 2*(1-Math.abs(1-a/2)); const end = Math.min(b,1)*length; const start = Math.max(0,b-1)*length; curve.setAttribute('stroke-dasharray',`${end-start} ${2*length}`); curve.setAttribute('stroke-dashoffset',-start); curve.setAttribute('stroke-width',width/2**(i)); }) requestAnimationFrame(frame); } frame();