blob: 1a932921fe2e250799d049db7a558b42a5e96739 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
varying vec4 v_position;
uniform vec2 u_resolution;
uniform float u_time;
#define MAX_ITERATIONS 100
#define DOTS 32.
void main() {
float time = u_time * 2.;
float ratio = u_resolution.x / u_resolution.y;
vec2 pos = v_position.xy/vec2(1.0, ratio);
gl_FragColor = vec4(0., 0., 0., 1.);
float segment = 2.0 / (DOTS + 1.);
for (float i = 0.; i < DOTS; i++) {
for (float j = 0.; j < DOTS; j++) {
int alt = int(mod(i + j, 2.));
vec2 step = vec2(segment * (i + 1.0), segment * (j + 1.0));
float radius = (sin(time - length(pos)) + 1.)*0.02;
if (alt == 0) {
radius = (0.04 - radius);
}
if (length(pos - 1. + step) < radius) {
if (alt == 0) {
gl_FragColor = vec4(.17, .24, .31, 1.);
} else {
gl_FragColor = vec4(0.75, 0.22, 0.17, 1.);
}
}
}
}
}
|