Overview
This code snippet demonstrates a 3D animation of golden spheres falling and bouncing with realistic physics. Each sphere has its own delay, size, and bounce properties, creating a visually dynamic scene with proper lighting and material properties.Complete Code
What This Snippet Demonstrates
Realistic Physics Simulation
Realistic Physics Simulation
Implements gravity, velocity, and restitution (bounciness) for authentic falling and bouncing behavior. Each sphere has its own physics properties.
Squash and Stretch
Squash and Stretch
Applies squash and stretch deformation on impact to enhance the sense of weight and energy, a classic animation principle.
Three.js Integration
Three.js Integration
Uses
@remotion/three to render a 3D scene with proper camera positioning, lighting, and material properties.Staggered Delays
Staggered Delays
Each sphere has a different delay before it starts falling, creating visual interest and avoiding simultaneous movements.
Key Concepts
Physics Simulation: ThesimulateBounce function calculates realistic motion using:
- Gravity acceleration (12 units/s²)
- Initial velocity from free fall
- Energy loss on each bounce (restitution = 0.75 means 75% velocity retained)
- Squash deformation based on proximity to ground
meshStandardMaterial with:
- Metalness (0.4) for reflective quality
- Roughness (0.6) for surface texture
- Emissive color for self-illumination
When to Use This Pattern
- Product showcases with physical objects
- Logo reveals with dynamic 3D elements
- Abstract motion graphics with geometric shapes
- Science or physics visualizations
- Eye-catching intro animations
Customization Tips
- Physics
- Visual Style
- Scene Setup
- Quantity
Adjust
gravity (higher = faster fall), restitution (0.5 = less bouncy, 0.95 = super bouncy), or startY for drop height.This example requires
@remotion/three to be installed. The physics simulation runs at the specified fps for accurate timing across different frame rates.