All examples By author By category About

kenpenn

disco lights

An expansion of Self-adjusting setTimeout loop in javascript

Uses a self-adjusting timeout loop to trigger events, at somewhat consistent intervals, to drive animation.

Uncorrected loops shows a setTimeout with a fixed delay, the same delay as the adjusted setTimeout target.

Metronome drawn with Sketch

adapted from: