#version 300 es
precision highp float;
uniform vec2 uResolution;
uniform vec2 uMouse;
out vec4 outColor;
float circleSdf(vec2 xy, vec2 center, float radius) {
vec2 fromCenter = xy - center;
return pow(dot(fromCenter, fromCenter), 0.5) - radius;
}
float circle(vec2 xy, vec2 center, float radius, float spread) {
float sdf = circleSdf(xy, center, radius);
return smoothstep(radius - radius * spread, radius + radius * spread, sdf);
}
void main() {
vec2 pos = (2.0 * gl_FragCoord.xy - uResolution.xy) / min(uResolution.x, uResolution.y);
vec2 mouse = (2.0 * uMouse.xy - uResolution.xy) / min(uResolution.x, uResolution.y);
mouse.y *= -1.0;
outColor.rgb = vec3(1.0 - circle(pos, mouse, 0.3, 0.005));
outColor.a = 1.0;
}