Happy Valentines Day

GLSL shader by scry · created 2026-02-14 · 10s loop · 2 passes

Tags: 2d, Animation, Particles, Abstract, Symmetry, Layers

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 dot2(in vec2 v) { return dot(v,v); }
float sdHeart(in vec2 p) {
    p.x = abs(p.x);
    if( p.y+p.x>1.0 )
        return sqrt(dot2(p-vec2(0.25,0.75))) - sqrt(2.0)/4.0;
    return sqrt(min(dot2(p-vec2(0.00,1.00)),
                    dot2(p-0.5*max(p.x+p.y,0.0)))) * sign(p.x-p.y);
}
float hash(vec2 p) {
    return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
}
vec3 palette(float t, vec3 a, vec3 b, vec3 c, vec3 d) {
    return a + b*cos(6.28318*(c*t+d));
}

Buffer A (iChannel0)

// Heart particle structure: xy = position, zw = velocity
// We store particles in pixel rows. Row 0 = particle data, rest = visual buffer.

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord.xy / iResolution.xy;
    vec2 p = (fragCoord - 0.5*iResolution.xy) / iResolution.y;
    p.y += 0.3;
    // Dark romantic background gradient
    vec3 bg = mix(vec3(0.02, 0.0, 0.04), vec3(0.12, 0.0, 0.08), uv.y);
    
    // Add subtle radial glow
    float bgGlow = exp(-3.0*dot(p, p));
    bg += vec3(0.15, 0.02, 0.06) * bgGlow;
    
    vec3 col = bg;
    
    // === Main beating heart ===
    float beat = 1.0 + 0.06*sin(time*3.0) + 0.03*sin(time*6.0);
    vec2 hp = p;
    hp.y -= 0.05;
    hp *= 2.8 / beat;
    hp.y = hp.y - 0.4;
    
    float d = sdHeart(hp);
    
    // Heart body - rich red with gradient
    vec3 heartCol = mix(vec3(0.8, 0.05, 0.1), vec3(0.95, 0.15, 0.2), smoothstep(-0.3, 0.1, hp.y));
    // Specular highlight
    float spec = exp(-8.0*dot(hp - vec2(-0.15, 0.6), hp - vec2(-0.15, 0.6)));
    heartCol += vec3(0.4, 0.2, 0.2) * spec;
    
    // Smooth heart shape
    float heartMask = 1.0 - smoothstep(-0.01, 0.02, d);
    col = mix(col, heartCol, heartMask);
    
    // Outer glow
    float glow = exp(-8.0*max(d, 0.0));
    col += vec3(0.9, 0.1, 0.2) * glow * 0.6;
    
    // Pulsing aura
    float aura = exp(-3.5*max(d, 0.0)) * (0.5 + 0.5*sin(time*4.0));
    col += vec3(1.0, 0.3, 0.4) * aura * 0.3;
    
    // === Floating mini hearts / particles ===
    for(int i = 0; i < 30; i++) {
        float fi = float(i);
        float seed = fract(sin(fi * 12.9898 + fi*3.7) * 43758.5453);
        float seed2 = fract(sin(fi*2.3 + fi*1.1 * 78.233) * 43758.5453);
        
        // Particle position - rising and swaying
        float speed = 0.1 + seed * 0.15;
        float yy = fract(-0.35 + time/(2.0*pi) * speed + seed) * 2.0 - 0.7;
        float xx = (seed2 - 0.5) * 1.2 + sin(time + fi*1.3) * 0.15;
        
        vec2 pp = p - vec2(xx, yy);
        float size = 0.015 + seed * 0.02;
        
        // Tiny heart SDF
        vec2 thp = pp / size;
        thp.y = thp.y - 0.4;
        float td = sdHeart(thp);
        
        float tmask = 1.0 - smoothstep(-0.01, 0.05, td);
        float tglow = exp(-5.0*max(td*size, 0.0)/size);
        
        // Color variation
        vec3 pcol = mix(vec3(1.0, 0.3, 0.4), vec3(1.0, 0.6, 0.7), seed);
        float alpha = 0.4 + 0.6*seed;
        
        col += pcol * tmask * alpha;
        col += pcol * tglow * 0.15 * alpha;
    }
    
    // === Sparkles ===
    for(int i = 0; i < 20; i++) {
        float fi = float(i);
        vec2 sp = vec2(fract(sin(fi*7.3) * 43758.5453) - 0.5, fract(sin(fi*5.1) * 43758.5453) - 0.5) * vec2(iResolution.x/iResolution.y, 1.0);
        float twinkle = pow(max(sin(time + fi*2.7), 0.0), 8.0);
        float sd = length(p - sp);
        col += vec3(1.0, 0.8, 0.9) * twinkle * exp(-300.0*sd*sd) * 0.8;
    }
    
    // Vignette
    float vig = 1.0 - smoothstep(0.4, 1.4, length(p*vec2(0.8, 1.0)));
    col *= vig;
    
    // Subtle film grain
    col += (hash(fragCoord + fract(iTime)) - 0.5) * 0.02;
    
    // Tone mapping
    col = col / (1.0 + col);
    col = pow(col, vec3(1.0/2.2));
    
    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