Named Constants
The same emoji. The same animation. Every number now has a name.
A settings panel at the top. One change propagates everywhere.
Magic Numbers Lie. Names Tell the Truth.
Phase 2 makes one structural change to Phase 1: every literal number moves out of the drawing functions and into a named constant at the top of the file. The drawing commands are unchanged. The visual output is identical. What changes is whether the code explains itself.
// PHASE 1: magic numbers — what does 1.9 mean? What does 2 mean? let spiralSpeed = frameCount * 2; rotate(-spiralSpeed * 1.9); // PHASE 2: named constants — the code now explains Ethan's decisions var EYE_SPEED_MULT = 2; // base spin speed var EYE_R_SPEED_MULT = 1.9; // right eye spins 1.9× faster — Ethan's deliberate choice ... let spiralSpeed = frameCount * EYE_SPEED_MULT; rotate(-spiralSpeed * EYE_R_SPEED_MULT);
EYE_R_SPEED_MULT = 1.9 in the settings panel at the top of the greenbar.
Change it to 3.0 — the right eye spins dramatically faster and the
asymmetric, unhinged quality intensifies. Change it to 1.0 — both eyes
spin at identical speeds and the crazed asymmetry vanishes entirely. One value.
Instant feedback. That is why we name things.
Live Animation — Phase 2
Visually identical to Phase 1 and the original — the refactor touched only
the form of the numbers, not the numbers themselves.