35 lines
743 B
GLSL
35 lines
743 B
GLSL
// this took way too long
|
|
#ifdef GL_ES
|
|
precision mediump float;
|
|
#endif
|
|
|
|
uniform vec2 u_resolution;
|
|
uniform float u_time;
|
|
uniform vec2 u_mouse;
|
|
|
|
float random(in float x) {
|
|
return fract(sin(x)*1e6);
|
|
}
|
|
|
|
float col(vec2 st, vec2 v) {
|
|
float mouse = .3+clamp((u_mouse.x/u_resolution.x), 0., .6);
|
|
vec2 pos = st+v;
|
|
return step(mouse, random(70.+pos.x*0.00001));
|
|
}
|
|
|
|
void main() {
|
|
vec2 st = gl_FragCoord.xy/u_resolution.xy;
|
|
st.x *= u_resolution.x/u_resolution.y;
|
|
|
|
st *= vec2(10.,50.);
|
|
|
|
vec2 s = vec2(u_time*30.)*(vec2(-1.,0.)*random(floor(st.y)+1.));
|
|
|
|
vec2 o = vec2(0.02,0.);
|
|
|
|
vec3 color = vec3(col(st-o, s), col(st, s), col(st+o, s));
|
|
color *= step(0.2, fract(st).y);
|
|
|
|
gl_FragColor = vec4(1.-color,1.);
|
|
}
|