#version 300 es
precision highp float;
uniform vec2 uResolution;
uniform vec2 uMouse;
out vec4 outColor;
const float PI = 3.1415926;
float cdistance(vec2 from, vec2 to) {
vec2 diff = abs(to - from);
return max(diff.x, diff.y);
}
float circle(vec2 point, vec2 center, float radius) {
return cdistance(point, center) - radius;
}
vec3 contour(float v, float interval) {
return abs(v) < 0.01
? vec3(0.0)
: mod(v, interval) < 0.01
? vec3(1.0)
: mix(vec3(1.0, 0.0, 1.0), vec3(0.0, 1.0, 1.0), atan(v) / PI + 0.5);
}
void main() {
vec2 pos = (2.0 * gl_FragCoord.xy - uResolution.xy) / min(uResolution.x, uResolution.y);
float interval = 0.1;
outColor.rgb = vec3(contour(circle(pos, vec2(0.0), 0.7), interval));
outColor.a = 1.0;
}