A Pen by Stranger in the Q on CodePen.
Created
September 27, 2021 05:30
-
-
Save bozzin/a891fc4c8bec5c86cd798d9012271911 to your computer and use it in GitHub Desktop.
QWKbRgV
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
<!-- RGBA.js - my own super tiny webgl/fragment shader lib for codepen works | |
more examples at - https://codepen.io/collection/AWEWzK --> | |
<script src="https://rawcdn.githack.com/strangerintheq/rgba/0.0.5/rgba.js"></script> | |
<a target="_blank" href="https://github.com/strangerintheq/rgba">RGBA.js</a> |
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
RGBA(` | |
vec2 mirror(vec2 uv){ | |
const float count = 3.; | |
float a = 3.1415/count/2.; | |
float cs = cos(a), sn = sin(a); | |
mat2 rot = mat2(cs, -sn, sn, cs); | |
for (float i = 0.0; i<count; i++ ) | |
uv = abs(uv*rot); | |
return uv; | |
} | |
void main() { | |
vec2 uv = gl_FragCoord.xy/resolution-0.5; | |
uv.x *= resolution.x/resolution.y; | |
for(float i=1.; i<21.; i++) { | |
uv = mirror(uv); | |
uv -= i*0.02; | |
} | |
uv *= 21.; | |
vec2 index = floor(uv); | |
uv = fract(uv); | |
vec3 c = vec3( | |
smoothstep(0.1, 0.05, abs(fract(uv.x+time*0.2)-0.51)), | |
smoothstep(0.1, 0.05, abs(fract(uv.x+time*0.2)-0.55)), | |
smoothstep(0.1, 0.05, abs(fract(uv.x+time*0.2)-0.59)) | |
); | |
gl_FragColor = vec4(vec3(c), 1.0); | |
} | |
`) |
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
a { | |
position: fixed; | |
left: calc(50% - 40px); | |
font-size: 20px; | |
color: white; | |
mix-blend-mode: difference; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment