Rainbow Circles
GLSL Shader
Rainbow Circles
Shader loading...
View Source Code
float circle(vec2 st, vec2 center, float radius) {
float d = distance(st, center);
return smoothstep(radius, radius - 0.01, d);
}
void main() {
vec2 st = vUv;
st.x *= u_resolution.x / u_resolution.y;
st = st * 2.0 - 1.0;
vec3 color = vec3(0.1, 0.1, 0.15);
for (float i = 0.0; i < 6.0; i++) {
float angle = u_time * 0.5 + i * PI / 3.0;
float radius = 0.3 + 0.1 * sin(u_time + i);
float offset = 0.5 + 0.1 * sin(u_time * 0.7 + i);
vec2 pos = vec2(
offset * cos(angle),
offset * sin(angle)
);
vec3 circleColor = 0.5 + 0.5 * cos(u_time + i + vec3(0, 2, 4));
float c = circle(st, pos, radius);
color = mix(color, circleColor, c);
}
gl_FragColor = vec4(color, 1.0);
}