2015-07-21 20:25:41 +00:00
|
|
|
// Author @patriciogv - 2015
|
|
|
|
// http://patriciogonzalezvivo.com
|
|
|
|
|
|
|
|
#ifdef GL_ES
|
|
|
|
precision mediump float;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
uniform vec2 u_resolution;
|
|
|
|
uniform vec2 u_mouse;
|
|
|
|
uniform float u_time;
|
|
|
|
|
2015-07-21 21:37:00 +00:00
|
|
|
float random (in float x) { return fract(sin(x)*1e4); }
|
|
|
|
float random (in vec2 st) { return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123); }
|
2015-07-21 20:25:41 +00:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
vec2 st = gl_FragCoord.xy/u_resolution.xy;
|
|
|
|
st.x *= u_resolution.x/u_resolution.y;
|
|
|
|
|
|
|
|
vec3 color = vec3(0.0);
|
|
|
|
|
2015-07-21 21:37:00 +00:00
|
|
|
vec2 grid = vec2(100.0,2.0);
|
|
|
|
|
|
|
|
float t = u_time*max(grid.x,grid.y);
|
2015-07-21 20:25:41 +00:00
|
|
|
|
|
|
|
vec2 ipos = floor(st*grid);
|
|
|
|
vec2 fpos = fract(st*grid);
|
|
|
|
|
2015-07-21 21:37:00 +00:00
|
|
|
float value = random(floor(ipos.x+t));
|
2015-07-21 20:25:41 +00:00
|
|
|
|
2015-07-21 21:37:00 +00:00
|
|
|
if (mod(ipos.y,2.) == 0.) {
|
2015-07-21 20:25:41 +00:00
|
|
|
fpos = 1.0-fpos;
|
|
|
|
}
|
2015-07-21 21:37:00 +00:00
|
|
|
color += step(fpos.y*1.5,value);
|
|
|
|
|
2015-07-21 20:25:41 +00:00
|
|
|
gl_FragColor = vec4(color,1.0);
|
|
|
|
}
|