runnable fragment

Kaleidoscope

glitch-core generative glsl runnable fragment MIT
code snippet
precision mediump float;
varying vec2 v_texCoord;
uniform sampler2D u_texture;
uniform vec2 u_resolution;
uniform float u_sides;     // number of sides (2-16)
uniform float u_angle;     // rotation angle (0-6.28)
uniform vec2 u_center;     // center point (0-1)

void main() {
  vec2 uv = v_texCoord - u_center;
  float a = atan(uv.y, uv.x) + u_angle;
  float r = length(uv);
  float seg = 3.14159 * 2.0 / u_sides;
  a = mod(a, seg);
runnable fragment

Kaleidoscope Prism

stronghold-curated generative glsl runnable fragment MIT
code snippet
precision mediump float;
uniform vec2 resolution;
uniform float time;
void main(){
  vec2 uv=(gl_FragCoord.xy*2.0-resolution.xy)/min(resolution.x,resolution.y);
  float a=atan(uv.y,uv.x);
  float r=length(uv);
  float seg=3.14159/6.0;
  a=abs(mod(a+time*0.12,seg*2.0)-seg);
  vec2 p=vec2(cos(a),sin(a))*r;
  float v=sin(18.0*p.x+time)+sin(16.0*p.y-time*1.3)+sin(12.0*(p.x+p.y)+time*0.7);
  vec3 col=0.55+0.45*cos(vec3(0.0,2.1,4.2)+v+r*8.0+time*0.2);
  gl_FragColor=vec4(col*(1.0-smoothstep(0.85,1.25,r)),1.0);
}