Software Petal Burst
Petal Burst
A flower made of 32 solid-colored triangles. The petals burst outward and drain to white while the core holds still, and the entire effect is computed in the vertex shader.
How it works
The flower is a flat triangle list: an eight-segment core and eight petals of three triangles each. Every vertex carries a position, a color, and a flag that says whether it belongs to the core or to a petal.
- One animated number. JavaScript sends a single uniform,
explodeFactor, each frame. It follows a sine wave between 0 (assembled) and 1 (fully burst). - Displacement on the GPU. In the vertex shader, petal vertices slide away from the center along their own direction by
explodeFactor × maxShift. Core vertices pass straight through. - Color from the same number. Petal colors are blended toward white with GLSL
mix()using the same factor, so they dissolve into the white background as they travel outward. - One draw call. Core and petals share a single
drawArrayscall; the shader decides which vertices move.
Concepts
- Vertex shader displacement
- Per-vertex attributes
- Animated uniforms
- Color interpolation
- Triangle geometry
Built with
- WebGL
- GLSL
- JavaScript
Background
Written for CSE 470, Introduction to Computer Graphics, at Arizona State University. Uses the course-supplied webgl-utils and MV.js helper libraries.