Skip to content

Instantly share code, notes, and snippets.

@goldcaddy77
Created June 23, 2024 04:03
Show Gist options
  • Select an option

  • Save goldcaddy77/d61fdfcfed60dd96294da82509ce5390 to your computer and use it in GitHub Desktop.

Select an option

Save goldcaddy77/d61fdfcfed60dd96294da82509ce5390 to your computer and use it in GitHub Desktop.
Claude Sonnet 3.5 Bouncing Balls 3D World
Create a webpage that is a 3D simulation using WebGL that shows a number of balls bouncing in a large cube. Expose controls for updating:
- Number of Balls
- Gravity
- Cube Size
Note that if any of the following cannot be done without importing three.js OrbitControls, please skip adding those features and note that you're skipping them.
## User Interactions
- Clicking and dragging will spin the 3D world, relatively quickly, like your mouse is actually moving it
- When spinning the 3D world, the balls should respect the direction of the spin so that they're moving within the cube in a realistic way
- Include a "Bounce" button that will bounce all balls in the cube using the current settings, giving all balls a new random direction and speed
## UI Considerations
- Give the UI clean styles
- The controls should be in the top left and use pink sliders
## World Considerations
- Assume the floor has friction, so that as a ball rolls along it, it slows down
- The balls should slow down a bit when they hit the wall or floor
- The cube should be bright neon green
- The balls should use a neon punk color palette
Remember the following:
- If any of the following cannot be done without importing three.js OrbitControls, please skip adding those features and note that you're skipping them
- This is a 3D world, if you "spin the world," everything in the world should spin together, respecting the 3D space, including the cube and balls
- Be terse with your coding, you only have a certain amount of code you can fit in this file
- Spinning the cube should be fast, as if my mouse is rotating the cube
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment