Discovering the Art of Wavy Shader Animation
In the world of creative coding, sometimes the most captivating ideas emerge from playful experimentation. Join us as we explore a mesmerizing liquid motion effect created during our “12 Pens in 12 Months” challenge, where rules are tossed aside for pure creativity.
The Concept Behind the Effect
Our journey began with a simple question:
What if we could create motion that feels organic, something that flows instead of being mechanical?
We aimed for a “liquid between two worlds” experience, characterized by motion that breathes, stretches, and relaxes. This enchanting effect is achieved through a combination of:
- Fragment shaders to create geometric wave patterns
- Math-driven distortion utilizing sine waves and refraction
- RequestAnimationFrame for smooth and continuous updates
How the Animation Works
What sets this animation apart is the dynamic recalculation of wave paths on each frame. Rather than animating DOM elements, we reconstruct each pixel frame by frame within the shader.
Each cell behaves like a living surface, consistently pulsing, refracting, and rippling. Picture drawing with a rubber band—each point follows its predecessor with a slight delay, resulting in an enticingly gooey motion.
For optimal performance, we utilize:
- RequestAnimationFrame for fluid updates
- GPU-driven math to compute sine, refraction, and ripples directly in the shader
- A synchronization feature between GPU frames and browser refresh rates
Presets and Variations
Once we got the core system running, tweaking it became irresistible! A user-friendly control panel was created with four sliders to adjust shader parameters directly:
- Cell size (density of the grid)
- Amplitude (strength of refraction)
- Chromatic shift (color separation)
- Speed (rate of wave evolution)
By modifying any of these parameters, the mood of the animation transforms instantly, varying from soft and fluid to sharp and energetic.
Challenges Encountered
Of course, the journey wasn’t without its hurdles. We faced chaos when our smoothing logic fell short by one pixel, leading to unexpected spikes and flickers. Additionally, high-refresh monitors rendered the motion too smooth, prompting us to introduce slight imperfections to maintain that “handmade” character.
Try It Yourself!
Ready to experiment? The entire setup is open for exploration! Fork the project here and start adjusting the parameters to create your unique waves.
Consider altering:
- The number of points
- The easing curves
- The color gradients
Share your creations with us—we can’t wait to see the results!
Final Thoughts
Sometimes, the best ideas blossom from carefree exploration. What started as a quick internal experiment evolved into a rich and visually satisfying animation. We hope you enjoy it as much as we did in creating and refining it.
Related Keywords: wavy shader effect, creative coding, fragment shaders, animation techniques, visual effects, programming challenge, GPU animation.

