Keeping things on the screen

Click on the canvas with your mouse to put an object at that location and start it moving.

Source code: p5/MovingBouncing/sketch.js