Skip to content

Bouncing Ball in a Rotating Hexagon

Run the Ball in Hexagon MicroSim Edit the MicroSim with the p5.js editor

Just copy this iframe into your webpage to use the MicroSim in your classroom:

1
<iframe src="https://dmccreary.github.io/microsims/sims/ball-in-rotating-hexagon/main-v2.html" height="450px" width="400px"></iframe>

Edit this MicroSim using the p5.js editor

Version 1

Here is the first version we created using the new OpenAI o1-mini model without the slider for speed control and not responsive.

Prompt

Create a p5.js sketch that shows a ball bouncing inside a spinning hexagon. The ball should be affected by gravity and friction, and it must bounce off the rotating walls realistically.

Run the First Ball in Hexagon MicroSim

Special thanks to Linas Beliƫnas for the suggestion.