Moving Balls with Light

Your browser does not support the canvas tag.

This Application displays an array of moving balls within a 2D Space.

These moving balls, of different colours, interact with the borders, the walls as well as each other. The velocity of the moving balls decrease when they collide with the boundaries and each other. The diameter of the lightbulb is also adjustable by the 'up' and 'down' keyboard inputs, limited to a range between 1 and 100. The opacity of the shadows depend on the diameter of the lightbulb.

The damping factor, initially at 1, can be changed using the right and left mouse buttons. Any time a ball has an interaction with a boundary, or any other ball, its speed is multiplied by that damping factor. The damping factor can be adjusted using the 'left' and right' keyboard inputs. In addition, pressing the mouse left/right will automatically increase/decrease by 5%, depending on how long the mouse is pressed.

Source code: Main

Built with Processing and Processing.js