06.23 · 3D & Advanced
2D Physics
Balls drop where you click, bounce and pile up. Best for playful intros.
Click it
Click or tap anywhere in the box to drop a ball, drag a ball to throw it, or press Show me.
Inside, gravity speeds every ball down; where two touch (or a ball meets a wall) they push apart, and lower balls push harder, holding up the ones above. Click to drop a ball.
Pass through checks only the walls, so its balls sink into each other on the floor; Bump and pile also pushes touching balls apart, so none overlap. Click to drop a ball in both.
Try it
Change a setting, then drop a few balls or press Show me.
Gravity
How hard the balls are pulled down; on the Moon they float.
Bounciness
How much of its speed a ball keeps after each bounce.
Ball sizes
Mixed sizes pack into a looser, bumpier pile.
Copy the prompt
Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.
Add a box of bouncing balls to [the hero or empty area you want to liven up]. A click or tap drops a ball there; it falls, bounces off the walls and each other, and comes to rest in a pile. Dragging a ball with the pointer or a finger picks it up, and letting go throws it at the speed of the drag. Run the physics in fixed steps, as many as the time since the last frame needs, so it behaves the same on every screen, and stop drawing once everything is still. Fade out the oldest ball when there are too many. If the visitor has reduced motion turned on, show each new ball already resting where it would land. Match the settings listed below.
Your settings
Replace the words in brackets with your own element. Your settings are added at the end.
Free and open source. If this helped, a star on GitHub helps other people find it.
Star on GitHubWhat it is
The full explanation is in README.md.