beginner

#3 Animation

Using time to animate

Shaders run every single frame, so if you give them a clock, they can animate. The iTime uniform counts up in seconds each frame, and feeding it into sin() produces smooth oscillation — values that wave back and forth endlessly. By offsetting the phase for red, green, and blue channels independently, you get smoothly cycling rainbow colors. This is the core technique behind almost every animated shader effect.

Key Concepts

Try this shader live in the Shader Sandbox editor with real-time preview.
Open in Sandbox

Source Code


    
← Previous UV Coordinates Next → Shapes: Circle

All Tutorials