One Number. Everything Moves.
Drag the face size slider — watch 20 constants update and the canvas re-render instantly.
This is what recalcConstants() means in practice.
The Root Parameter
In the refactored sketch, FACE_DIAM was derived from canvas width:
FACE_DIAM = width * 0.48. That already made the sketch scalable —
resize the canvas, the emoji follows. But the dependency was invisible: a student who
resized the canvas had to trust that things would scale correctly.
This page makes the same mechanism explicit and interactive.
FACE_DIAM is now a direct variable set by the slider below.
recalcConstants() is called on every slider move. The constants readout
shows the cascade live. The canvas renders immediately. The cascade is no longer a
fact to memorize — it is something you can see and feel.
drawFace(), drawHeadphones(), etc. —
never mention FACE_DIAM. They only read the derived constants
(EAR_W, EYE_X, etc.). Moving the root parameter is therefore
invisible to them. That separation is the point. When concerns are separated,
each one is trivial to change.
Live Canvas — Phase 5 Running
fill(51, 100, 100)
stroke(212, 100, 100)
stroke(51, 100, 80)
Drag the size slider → canvas re-renders. No feature function changes.
That is separation of concerns, made tangible.