float inside(vec2 pixel) {
vec2 p = (pixel - 0.5 * uResolution) / min(uResolution.x, uResolution.y);
vec2 center = vec2(0.25 * sin(uTime * 0.5), 0.0);
return step(length(p - center), 0.300);
}
void main() {
float group = 8.0;
vec2 origin = floor(gl_FragCoord.xy / group) * group;
float here = inside(gl_FragCoord.xy);
float anyIn = 0.0;
float allIn = 1.0;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
vec2 s = origin + vec2(float(i), float(j)) * 0.5 * (group - 1.0) + 0.5;
anyIn = max(anyIn, inside(s));
allIn = min(allIn, inside(s));
}
}
float diverged = anyIn - allIn;
vec3 color = mix(vec3(0.48, 0.83, 0.69) * 0.45, vec3(0.96, 0.43, 0.30), here);
color = mix(color, vec3(1.0, 0.85, 0.3), diverged * 0.6);
vec2 local = mod(gl_FragCoord.xy, group);
color *= 1.0 - 0.35 * step(group - 1.0, max(local.x, local.y)) * step(4.0, group);
gl_FragColor = vec4(color, 1.0);
}