p5.js · 6 / 6

Dashboard
Creative coding · p5.js

Many agents — one draw loop

Store particle state in arrays or lightweight objects, update inside draw(), render with loops — same pattern scales from doodles to flocking. From here you can graduate toward classes or migrate hotspots into WebGL mode when CPU-bound.