diff --git a/10/ikeda-00.frag b/10/ikeda-00.frag new file mode 100644 index 0000000..b3c09d3 --- /dev/null +++ b/10/ikeda-00.frag @@ -0,0 +1,46 @@ +// 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; + +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); +} + +float randomSerie(float x, float freq, float t) { + return step(.8,random( floor(x*freq)-floor(t) )); +} + +void main() { + vec2 st = gl_FragCoord.xy/u_resolution.xy; + st.x *= u_resolution.x/u_resolution.y; + + vec3 color = vec3(0.0); + + float cols = 2.; + float freq = random(floor(u_time))+abs(atan(u_time)*0.1); + float t = 60.+u_time*(1.0-freq)*30.; + + if (fract(st.x*cols* 0.5) < 0.5){ + t *= -1.0; + } + + freq += random(floor(st.x)); + + float offset = 0.025; + color = vec3(randomSerie(st.y, freq*100., t+offset), + randomSerie(st.y, freq*100., t), + randomSerie(st.y, freq*100., t-offset)); + + gl_FragColor = vec4(color,1.0); +} \ No newline at end of file diff --git a/10/ikeda-01.frag b/10/ikeda-01.frag new file mode 100644 index 0000000..0ea001c --- /dev/null +++ b/10/ikeda-01.frag @@ -0,0 +1,40 @@ +// 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; + +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); +} + +void main() { + vec2 st = gl_FragCoord.xy/u_resolution.xy; + st.x *= u_resolution.x/u_resolution.y; + + vec3 color = vec3(0.0); + + float t = u_time*24.*2.; + + vec2 grid = vec2(2.0,50.0); + vec2 ipos = floor(st*grid); + vec2 fpos = fract(st*grid); + + float value = random(floor(ipos.y+t));// * pow(smoothstep(0.,.2,(1.0-ipos.y/grid.y)),.9)*mix((0.5+ipos.y/grid.y),1.0,1.0-ipos.y/grid.y) ; + + if (ipos.x == 0.) { + fpos = 1.0-fpos; + } + color += step(fpos.x*1.5,value); + + gl_FragColor = vec4(color,1.0); +} \ No newline at end of file diff --git a/10/ikdea-02.frag b/10/ikeda-02.frag similarity index 64% rename from 10/ikdea-02.frag rename to 10/ikeda-02.frag index 8f22a1c..f0677af 100644 --- a/10/ikdea-02.frag +++ b/10/ikeda-02.frag @@ -9,6 +9,10 @@ uniform vec2 u_resolution; uniform vec2 u_mouse; uniform float u_time; +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)))* @@ -17,22 +21,23 @@ float random (in vec2 _st) { void main() { vec2 st = gl_FragCoord.xy/u_resolution.xy; - st *= vec2(10.0,100.); + st.x *= u_resolution.x/u_resolution.y; + st *= vec2(100.0,50.); + vec3 color = vec3(0.0); vec2 ivec = floor(st); // integer vec2 fvec = fract(st); // fraction vec2 vel = floor(vec2(u_time*10.)); // time vel *= vec2(-1.,0.); // direction - vel *= (step(1., mod(ivec.y,2.0))-0.5)*2.; + + // vel *= (step(1., mod(ivec.y,2.0))-0.5)*2.; // Oposite directions + vel *= random(ivec.y); // random speed - ivec += vel; - + // Move + ivec += floor(vel); // Assign a random value base on the integer coord - vec3 color = vec3( step(.8,random( ivec ))); - - // Un comment to see the subdivided grid -// color = vec3(fvec,0.0); + color = vec3(1.0-step(.8,random(ivec))); gl_FragColor = vec4(color,1.0); } \ No newline at end of file diff --git a/10/ikeda-03.frag b/10/ikeda-03.frag new file mode 100644 index 0000000..b3c09d3 --- /dev/null +++ b/10/ikeda-03.frag @@ -0,0 +1,46 @@ +// 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; + +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); +} + +float randomSerie(float x, float freq, float t) { + return step(.8,random( floor(x*freq)-floor(t) )); +} + +void main() { + vec2 st = gl_FragCoord.xy/u_resolution.xy; + st.x *= u_resolution.x/u_resolution.y; + + vec3 color = vec3(0.0); + + float cols = 2.; + float freq = random(floor(u_time))+abs(atan(u_time)*0.1); + float t = 60.+u_time*(1.0-freq)*30.; + + if (fract(st.x*cols* 0.5) < 0.5){ + t *= -1.0; + } + + freq += random(floor(st.x)); + + float offset = 0.025; + color = vec3(randomSerie(st.y, freq*100., t+offset), + randomSerie(st.y, freq*100., t), + randomSerie(st.y, freq*100., t-offset)); + + gl_FragColor = vec4(color,1.0); +} \ No newline at end of file