This example demonstrates how to create 3D shapes using particle systems with rotation, multiple instances, and color variations.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/vaneenige/phenomenon/llms.txt
Use this file to discover all available pages before exploring further.
View live demo
See 3D shapes in action on CodePen
Complete example
Here’s the demo implementation that creates multiple rotating particle instances with different colors:Key concepts
Global rotation
Rotate all instances together by updating the model matrix:uModelMatrix uniform is shared across all instances, so updating it rotates the entire scene.
Multiple instances
Create multiple particle systems with different properties:- Unique key (the
countvariable) - Attributes (positions, colors)
- Uniforms (progress value)
- Render callback
Color cycling
Cycle through predefined colors for each instance:%) cycles through the color array.
Cube formation
Create a cube-like shape by clustering particles around a center point:Utility functions
The demo uses helper functions for common operations:Get random value
-max and max.
RGB to HSL conversion
Y-axis rotation
These utility functions are included in the demo (
demo/src/utils.js). You can adapt them for your own projects.Performance considerations
When working with multiple instances:- Use fewer instances with higher multipliers - This is more efficient than many instances with low multipliers
- Share uniforms - Global uniforms like matrices are automatically shared
- Reuse attributes - Use
prepareBuffer()to reuse existing data instead of recalculating
Next steps
Particle cube demo
See a complete particle cube example
Dynamic instances
Add and remove instances at runtime