Last active
September 14, 2021 00:09
-
-
Save tshirtman/53ae9c52890374802ef5e0fa49ec204e 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
$HEADER$ | |
float PI = 3.1415926535; | |
uniform vec2 resolution; | |
uniform float time; | |
vec2 rotate(vec2 pos, float angle, vec2 center){ | |
pos -= center; | |
pos *= mat2(cos(angle), sin(-angle), sin(angle), cos(angle)); | |
pos += center; | |
return pos; | |
} | |
vec2 scale(vec2 pos, float scale, vec2 center){ | |
pos -= center; | |
pos *= scale; | |
pos += center; | |
return pos; | |
} | |
float nsin(float v){ | |
return .5 + .5 * sin(v); | |
} | |
void main(){ | |
vec2 pos = gl_FragCoord.xy / resolution.xy; | |
vec2 center = vec2(.5, .5); | |
float line_width = 4. / resolution.x; | |
float r = 0.; float g = 0.; float b = 0.; | |
float d = distance(pos, center); | |
pos = rotate(pos, -time + 30. * log(sin(d)) / 10., center); | |
pos = scale(pos, nsin(time), center); | |
if (min(mod(pos.x, .1), mod(pos.y, .1)) < line_width) { | |
r = 1.0; | |
g = 1.0; | |
b = 1.0; | |
} | |
gl_FragColor = vec4( r, g, b, 1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment