Code and Gravity

Name this classical piece from the bounces

Every bounce of the ball plays one note, in order, of a famous melody. Can you name it?

Show the answer

CANON IN D

How it works

The ball bounces inside a pentagon and the notes come from the melody, not from the wall it hits. The backing track plays underneath, so the bounces sound like a person playing the tune. The melody has 32 notes. Try to name it before the ball finishes.

Questions

Why is it hard to recognise?
The rhythm follows when the ball hits a wall, not the song's real rhythm, so you recognise only the order of the notes.
Is this real physics or an animation?
It is a physics simulation. Collisions are computed 60 times per second from gravity, velocity and bounce rules, then drawn. Nothing is hand-animated.
Will it look the same every time?
Yes. Each video uses a fixed random seed, so the same run plays identically every time, on this site and in the video.
Watch on YouTube →

More like this