x
19
1
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
2
// Compute coordinates that range from x = -1 to 1 and y = -1 to 1.
3
vec2 uv = fragCoord / iResolution.xy;
4
uv = 2. * (uv - 0.5);
5
6
// The signed distance to the edge of a circle.
7
float radius = 0.8 + 0.1 * sin(6.28318530 * iTime / iDuration);
8
float circleDist = length(uv) - radius;
9
10
// Compute the color of the pixel as a mix of red and blue,
11
// depending on the distance to the circle.
12
vec3 col = mix(
13
vec3(0.800, 0.184, 0.277), // red
14
vec3(0.049, 0.111, 0.215), // dark blue
15
smoothstep(0., 2. / iResolution.x, circleDist)
16
);
17
18
fragColor = vec4(col, 1.0);
19
}
1264×1264px
0