Project_2026-07-24_15-10-23

GLSL shader by scry · created 2026-07-24 · updated 2026-07-29 · 20s loop · 2 passes

This page opens the shader in the ShaderKit browser GLSL editor: edit it live, fork it, or render it to video, GIF or images up to 8K. Also available as a full-screen view and an embeddable player.

Shader source (GLSL)

Common

#define pi acos(-1.)
#define deg pi/180.  //1 degree
#define time iTime*2.*pi/10. //sin(time) loops 10 seconds
#define R iResolution.xy //shorthand
#define ar R.x/R.y //aspect ratio
#define M iMouse //shorthand
#define xm (M.xy/R) //normalized mouse
#define nm ((xm.xy-0.5)*vec2(ar,1.)+0.5) //aspect ratio correction
vec3 cs = vec3(1.,2.,3.);
mat2 r2d(float a) {
    return mat2(cos(a),sin(a),-sin(a),cos(a));
}

float dotcircle(vec2 uv, float s, float count, float t) {
    uv *= r2d(t);
    
    //s = (sin(time*1.)*0.5+0.5)*4.;
    s = 1./(s+0.2);
    vec2 v = vec2(length(uv),atan(uv.x,uv.y));
    float o = v.x;
    v.x = log(v.x);
    v.x += s;
    v.y /= pi*2.;
    v.x *= 0.15;
    v.y = (fract(v.y*count)-0.5)/count;
    
    v *= o+0.01;
    return smoothstep(0.005,0.,length(v));
}

Buffer A (iChannel0)

float sdSegment(in vec2 p, in vec2 a, in vec2 b) {
    vec2 pa = p-a, ba = b-a;
    float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
    return length( pa - ba*h );
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord.xy / iResolution.xy;
    vec2 tv = uv;
    
    // Staggered element appearance using sine waves with shifted phases
    float phaseOffset = pi * 2.0 / 6.0; // 60 degrees per element
    float showRed = pow(sin(time * 0.5) * 0.5 + 0.5, 18.0);
    float showCyan = pow(sin(time * 0.5 - phaseOffset * 0.5) * 0.5 + 0.5, 18.0);
    float showGreen = pow(sin(time * 0.5 - phaseOffset * 2.0) * 0.5 + 0.5, 18.0);
    float showPurple = pow(sin(time * 0.5 - phaseOffset * 2.5) * 0.5 + 0.5, 18.0);
    float showBlue = pow(sin(time * 0.5 - phaseOffset * 4.0) * 0.5 + 0.5, 18.0);
    float showYellow = pow(sin(time * 0.5 - phaseOffset * 4.5) * 0.5 + 0.5, 18.0);
    uv -= 0.5;
    uv.x *= ar;
    vec3 col = vec3(0.);
    uv *= 3.;
    const int dots = 6;
    // Compute dot positions for all 6 points first
    vec2 dotPositions[dots];
    vec2 dotPositions2[dots];
    vec2 blueDotPositions[dots];
    for (int i=0;i<dots;i++) {
        float ii = float(i);
        float dots = float(dots);
        float s1 = 1.;
        float s2 = 0.435;
        vec2 offs = sin(vec2(0.,1.57)-ii*pi*2./dots+0.)*s1;
        float os = pi/2.;
        dotPositions[i] = -(offs + vec2(sin(-time-ii*pi*2./1.-os), cos(-time-ii*pi*2./1.-os))*s2);
        dotPositions2[i] = -(offs + vec2(sin(-time-ii*pi*2./1.-os+pi), cos(-time-ii*pi*2./1.-os+pi))*s2);
    }
    
    for (int i=0;i<dots;i++) {
        float ii = float(i);
        float dots = float(dots);
        float s1 = 1.;
        float s2 = 0.435;
        vec2 offs = sin(vec2(0.,1.57)+ii*pi*2./dots)*s1;
        vec2 offs2 = cos(vec2(0.,1.57)+ii*pi*2./dots-time)*s2;
        
        // Blue ring: track actual distance from origin to the moving dots
        // A dot sits on the red circle (center=offs, radius=s2) at angle=time
        // Its position is offs + s2*vec2(sin(...), cos(...))
        // Store the dot position for cyan lines
        vec2 dotPos = offs + vec2(sin(time+ii*pi*2./(dots/2.)-pi/2.), cos(time+ii*pi*2./(dots/2.)-pi/2.))*s2;
        float blueDist = length(dotPos);
        
        col += dotcircle(uv+offs, 1.,2., time);
        
        col += smoothstep(0.01,0.,abs(length(uv+offs)-(s2)))*vec3(1.,0.,0.)*showRed;
        
        blueDotPositions[i] = -dotPos;
        if (i==int(dots/2.)||i==0) col += smoothstep(0.01,0.,abs(length(uv+offs2)-s1))*vec3(0.,1.,0.)*showGreen;
        col += smoothstep(0.01,0.,abs(length(uv)-blueDist))*vec3(0.,0.,1.)*showBlue;
    }
    
    // Draw purple lines between consecutive dot positions
    for (int i=0;i<dots;i++) {
        int j = (i+1) % dots;
        float d = sdSegment(uv, dotPositions[i], dotPositions[j]);
        col += smoothstep(0.01, 0., d) * vec3(1., 0.0, 1.0) * showPurple;
    }
    
    // Draw second purple hexagon (opposite phase)
    for (int i=0;i<dots;i++) {
        int j = (i+1) % dots;
        float d = sdSegment(uv, dotPositions2[i], dotPositions2[j]);
        col += smoothstep(0.01, 0., d) * vec3(1., 0.0, 1.0) * showPurple;
    }
    
    // Draw yellow lines connecting corresponding vertices between the two hexagons
    for (int i=0;i<dots;i++) {
        float d = sdSegment(uv, dotPositions[i], dotPositions2[i]);
        col += smoothstep(0.01, 0., d) * vec3(0.0, 1.0, 1.0) * showCyan;
        
    }
    
    // Draw cyan lines connecting consecutive dots on the blue circles
    for (int i=0;i<dots;i++) {
        int j = (i+dots/2) % dots;
        float d = sdSegment(uv, dotPositions[i], dotPositions2[j]);
        col += smoothstep(0.01, 0., d) * vec3(1.0, 1.0, 0.0) * showYellow;
        col = clamp(col,0.,1.);
    }
    
    //col += smoothstep(0.003,0.,abs(length(uv)-sin(0.*pi*2./6.-time-0.0)*0.3-0.435))*vec3(0.,0.,1.);
    //col = mix(vec3(0.29+sin(time*2.)*0.2),vec3(1.),col.x);
    fragColor = vec4(col, 1.0);
}

Image

Not used

More shaders by scry

Browse all public shaders · All shaders by scry · ShaderKit home

Vibe Mode BETA
💰 ~0 credits
Uniforms
FPS: 0
Time: 0
Resolution: 0 x 0

Account

FPS: -- Time: -- --×-- 1x