Bouncing balls
This stack demonstrates how to create a number of graphics representing bouncing balls.
Each ball is given a random starting direction and a loop is used to calculate the new position of each ball on each iteration of the loop, taking into account the edges of the stack, gravity and friction.
The user can create new balls by clicking on the stack and can agitate the balls by shaking a mobile device, on desktop platforms a shake can be simulated by clicking a button.