#version 300 es
precision highp float;
uniform vec2 uResolution;
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 = gl_FragCoord.xy / uResolution.xy;
pos *= 2.0;
pos -= 1.0;
float aspect = uResolution.x / uResolution.y;
pos.x *= aspect;
pos *= 5.0;
vec2 center = vec2(0.5, 0.0);
outColor.rgb = vec3(1.0 - circle(vec2(fract(pos.x + 0.5), pos.y), center, 0.1, 0.1));
outColor.a = 1.0;
}