Last active
June 16, 2022 01:31
-
-
Save tshirtman/c72058c08a1dd0e82ea5dc3b899a3e55 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 origin) { | |
pos -= origin; | |
pos *= mat2(cos(angle), sin(-angle), sin(angle), cos(angle)); | |
pos += origin; | |
return pos; | |
} | |
float circle(vec2 point, vec2 center, float radius, float thickness) { | |
float d = distance(point, center); | |
return sin( | |
max(0., min(pi, radius - d * pi / thickness)) | |
); | |
} | |
void main() { | |
vec2 center = resolution / 2.; | |
vec2 pos = gl_FragCoord.xy; | |
pos = rotate(pos, sin(time / 2.) * log(distance(pos, center) / 50.), center); | |
pos *= .45 + .45 * sin(time) * sin(distance(pos, center) / 200.); | |
pos *= .75 + .5 * sin(-time); | |
float v = circle( | |
mod(pos, abs(.5 * sin(time / 2.) + .75) * (.7 + .4 * sin(time / 3.)) * 50.) + center - vec2(25., 25.), | |
center, | |
50., | |
2. | |
); | |
vec3 c = vec3( | |
.5 + .5 * atan(pos.y, pos.x) / pi, | |
.5 + .5 * atan(pos.x, pos.y) / pi, | |
.5 + .5 * sin(time) | |
); | |
gl_FragColor = vec4(c * v, 1.); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment