Skip to content

Instantly share code, notes, and snippets.

@gak
Created January 21, 2014 09:51
Show Gist options
  • Save gak/8537275 to your computer and use it in GitHub Desktop.
Save gak/8537275 to your computer and use it in GitHub Desktop.
dude
void main(void)
{
float x,y;
float ratio = iResolution.y / iResolution.x;
x = gl_FragCoord.x / iResolution.x - 0.5;
y = gl_FragCoord.y / iResolution.y * ratio - 0.25;
float PI = 3.14159265358979323846264;
vec2 position = vec2(x, y);
float angle = 0.0;
float radius = length(position);
angle = degrees(atan(x, y));
float amod = mod(angle + 30.0 * fract(iGlobalTime * 1.0) - 120.0 * log(radius), 30.0);
gl_FragColor = vec4(amod / 30.0, amod * cos(iGlobalTime * 3.0), sin(iGlobalTime) * 2.0, 1);
/*
if (amod < 15.0)
gl_FragColor = vec4(1,1,1,1);
else
gl_FragColor = vec4(1,0,0,1);
*/
/*
vec2 tc = vec2(tx, ty);
vec2 norm = (1.0 - tc) * 2.0 - 1.0;
float theta = PI + atan(norm.x, norm.y);
float r = length(norm);
vec2 polar = 1.0 - vec2(theta / (2.0 * PI), r);
float xxx = r * cos(PI);
vec4 color = vec4(xxx, polar.y, 0, 1.0);
gl_FragColor = color;
*/
//tx = tx * 2.0 * PI - PI;
//ty = ty * 2.0 * PI - PI;
//tx = log(sqrt(tx * tx + ty * ty));
//ty = atan(ty, tx);
// tx = exp(tx) * 1000.0;
/*
if ((tx > 0.5 && ty > 0.5) || (tx < 0.5 && ty < 0.5)) {
gl_FragColor = vec4(0.3, 0.4, 0.5, 1);
} else {
gl_FragColor = vec4(0, 0, 0, 1);
}
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment