Shader playground
GPU backgrounds you can tune live. Start from a preset or write your own GLSL, then copy it as a React component.
precision highp float;
uniform float u_time; // seconds
uniform vec2 u_resolution; // canvas size in pixels
uniform vec2 u_mouse; // pointer, 0–1, smoothed
uniform vec3 u_color1; // @color #ffb38a Colour 1
uniform vec3 u_color2; // @color #ff4f8b Colour 2
uniform vec3 u_color3; // @color #6b5bff Colour 3
uniform vec3 u_color4; // @color #22c3ff Colour 4
uniform float u_warp; // @range 0 1 0.55 Warp
uniform float u_grain; // @range 0 0.15 0.035 Grain
float hash(vec2 p) {
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
}
float noise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
return mix(mix(hash(i), hash(i + vec2(1.0, 0.0)), u.x),
mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x), u.y);
}
void main() {
vec2 uv = gl_FragCoord.xy / u_resolution;
float aspect = u_resolution.x / u_resolution.y;
vec2 p = vec2(uv.x * aspect, uv.y);
float t = u_time * 0.12;
// Bend space with slow noise so the blend never looks radial.
vec2 w = vec2(noise(p * 1.4 + t), noise(p * 1.4 - t + 4.7)) - 0.5;
p += w * u_warp * 0.7;
// Four drifting anchors; the last one leans toward the pointer.
vec2 a1 = vec2(0.12 * aspect + 0.12 * sin(t * 1.7), 0.18 + 0.14 * cos(t * 1.3));
vec2 a2 = vec2(0.88 * aspect + 0.12 * cos(t * 1.1), 0.22 + 0.18 * sin(t * 1.9));
vec2 a3 = vec2(0.22 * aspect + 0.16 * cos(t * 1.4), 0.86 + 0.12 * sin(t * 1.2));
vec2 a4 = vec2(0.80 * aspect + 0.12 * sin(t * 1.5), 0.80 + 0.12 * cos(t * 1.6));
a4 = mix(a4, vec2(u_mouse.x * aspect, u_mouse.y), 0.3);
// Inverse-distance weights give the soft mesh falloff.
float w1 = 1.0 / (0.03 + pow(distance(p, a1), 2.4));
float w2 = 1.0 / (0.03 + pow(distance(p, a2), 2.4));
float w3 = 1.0 / (0.03 + pow(distance(p, a3), 2.4));
float w4 = 1.0 / (0.03 + pow(distance(p, a4), 2.4));
vec3 col = (u_color1 * w1 + u_color2 * w2 + u_color3 * w3 + u_color4 * w4) / (w1 + w2 + w3 + w4);
col += (hash(gl_FragCoord.xy) - 0.5) * u_grain;
gl_FragColor = vec4(col, 1.0);
}Keep exploring
More playgrounds to try next.