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.
Quickstart
This guide will walk you through creating your first working particle system with Phenomenon. You’ll learn how to set up the renderer, define particle attributes, write shaders, and render thousands of particles to the screen.Prerequisites
Make sure you have:- Phenomenon installed (see installation guide)
- A
<canvas>element in your HTML - Basic understanding of JavaScript
No prior WebGL or shader experience is required - we’ll explain each step.
Create your first particle system
Create the renderer
Initialize a Phenomenon instance. This sets up the WebGL context and rendering loop:What’s happening here:
devicePixelRatio: 1sets the rendering resolution (1 for better performance,window.devicePixelRatiofor sharper quality)positionsets the camera’s position in 3D space (z: 3 moves the camera back so you can see the particles)
Define particle attributes
Attributes define the data for each particle. Each attribute needs a name (used in shaders), size (number of values), and a data function:What’s happening here:
aPositionStartgives each particle a random 3D position (x, y, z) centered around the originaColorassigns each particle a random RGB color- The
datafunction is called once per particle to generate unique values
Write the vertex shader
The vertex shader positions each particle in 3D space:What’s happening here:
attributevariables receive per-particle data from our attributes arrayuniformvariables are the same for all particles (projection, model, view matrices handle camera positioning)varyingvariables pass data to the fragment shadergl_Positionsets where the particle appears on screengl_PointSizecontrols how large each particle is (in pixels)
Write the fragment shader
The fragment shader colors each particle:What’s happening here:
varying vec3 vColorreceives the color from the vertex shadergl_FragColorsets the final pixel color (RGB + alpha)
Complete example
Here’s the full code put together:Adding animation
To make your particles move, add anonRender hook and use uniforms:
Next steps
You’ve created your first particle system! Here’s what to explore next:API Reference
Learn about all available options and methods
Examples
Browse more complex particle effects and techniques
Shaders Guide
Deep dive into writing custom vertex and fragment shaders
Performance Tips
Optimize your particle systems for maximum FPS