Bouncing Block: Many

We now extend to N bouncing blocks with coordinates (x[i],y[i]) and velocities (vx[i],vy[i]) as arrays with index i =0,…,N-1. Time stepping for all blocks is done with a do-loop

for (var i=0; i<N; i++){
x[i]=x[i]+vx[i]*dt;
y[i]=y[i]+vy[i]*dt;
}

Similarly a do-loop is used to bounce-reflect all blocks.

Watch and play.  Admire a short code with a rich output.

Try Ray Tracing! See also Ray Tracing in Color!

And also Jackson Pollock! (action painting).

Compare with Vanishing Action Painting.

Watch similar code with particles instead of blocks.