Created
August 25, 2016 16:48
-
-
Save antoineMoPa/941fd38a9b166ed540bce6f3aeb9ab6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fragment shader | |
precision highp float; | |
varying vec2 UV; | |
varying vec3 v_position; | |
uniform float time; | |
uniform float ratio; | |
uniform vec2 mouse; | |
void main(void){ | |
float x = UV.x * ratio; | |
float y = UV.y; | |
vec4 col = vec4(0.0); | |
x *= distance(mouse, vec2(x, y)); | |
y *= distance(mouse, vec2(x, y)); | |
float maxit = 0.0; | |
float sintime = sin(3.1416 * 2.0 * time); | |
vec2 val = vec2(x, y); | |
for(int i = 0; i < 10; i++){ | |
maxit = float(i); | |
float l = length(val); | |
val.x *= l * cos(10.0 * x - 3.1416 * time) + 0.01 * sintime; | |
val.y *= l * sin(10.0 * y); | |
if(length(val) > 18.0){ | |
break; | |
} | |
} | |
col.rg = vec2(maxit / 10.0); | |
col.b = maxit/8.0; | |
col.a = 1.0; | |
gl_FragColor = col; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment