Shaders · 3 / 6

Dashboard
Creative coding · Shaders

Uniforms bridge JS → GPU

The CPU uploads constants each frame: here u_time is seconds since start and u_resolution is drawable pixels. Offset phase inside sin/cos with u_time and shapes breathe without recomputing meshes.

uniform float u_time;
float w = sin(uv.y * 6.28318 + u_time * 2.0) * 0.15;
float line = smoothstep(0.02, 0.0, abs(uv.y - 0.5 - w));
Pro tip

Keep time scales readable — multiply by small floats (< 5) before stuffing into trig unless you want seizure-fast shimmer.

Next

length() for radial masks.