precision mediump float;
varying vec2 a_pos;
uniform float u_time; //seconds since page load
uniform float u_stime; //seconds since shader compile
uniform vec4 u_mouse; //xy: current pos, zw: click pos
uniform vec2 u_resolution;
uniform float u_frame; //frame counter
uniform float u_timedelta; //time between frames
uniform sampler2D u_channel0; //texture input
void mainImage( out vec4 c, in vec2 fc )
{
vec2 uv = fc / u_resolution;
// Create animated gradient
vec3 color = 0.5 + 0.5 * cos(u_time + uv.xyx + vec3(0, 2, 4));
// Add mouse interaction
vec2 mouse = u_mouse.xy / u_resolution;
float d = length(uv - mouse);
color *= 1.0 - smoothstep(0.0, 0.5, d);
c = vec4(color, 1.0);
}
void main(void) {
vec2 uv = a_pos;
mainImage(gl_FragColor, uv);
}