Great explanation @jeff!
Quick clarification on a minor detail. time()
's timebase is snapshotted for each animation frame. So a call to time()
in beforeRender()
is the same as a call to time()
in render()
even for a lot of pixels or really slow code.
This way an animation frame doesn’t have any skew or “tearing” that might otherwise occur, for example if you use time()
to draw a threshold where the difference would be more noticeable than a smooth gradient. I think of it more as an animation time base than a measurement of real time.