#version 300 es
precision highp float;
uniform vec2 uResolution;
uniform vec2 uMouse;
out vec4 outColor;
const float PI = 3.1415926;
float circle(vec2 point, vec2 center, float radius) {
float d = 0.5 + uMouse.x / uResolution.x;
return pow(dot(point - center, point - center), d) - 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.3;
outColor.rgb = vec3(contour(circle(pos, vec2(0.0), 1.0), interval));
outColor.a = 1.0;
}