struct VertexOutput { @builtin(position) position: vec4, @location(0) coord: vec2, }; struct Uniforms { mouse: vec2, time: f32, _pad: f32, window_size: vec2, }; @group(0) @binding(0) var uniforms: Uniforms; @fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { let aspect = uniforms.window_size.xy * 2.0 / uniforms.window_size.y; let normalized = (in.coord * aspect + vec2(1., 1.)) / 2.; let r = 0.25 + 0.25 * sin(uniforms.time); let delta = abs(uniforms.mouse * aspect - in.coord * aspect - vec2(r/2., r/2.)) % vec2(r, r) - vec2(r / 2., r / 2.); let c = dot(delta, delta); if (c > (r / 100.)) { discard; } return vec4(1.0, normalized.rg, 1.0); }