Kleurverloop met ruis
Four colour points drift across the surface and blend through soft noise into a gradient with fine grain; three palettes show how it looks in other brand colours.
How to use it
- Paste the HTML where the backgrounds & webgl should appear. Include the script tags at the top once per page.
- Add the CSS to your stylesheet. All classes are prefixed, so nothing clashes with your own styles.
- Add the JavaScript and call init() with the element that contains the HTML.
<!-- Kleurverloop met ruis · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie -->
<!-- benodigd, één keer per pagina: -->
<script type="module">import * as OGL from "https://esm.sh/ogl@1.0.11"; window.OGL = OGL;</script>
<div class="jouw-container">
<div class="hrng"><div class="hrng__fb" aria-hidden="true"></div><div class="hrng__kies" role="group" aria-label="Palet kiezen"><button class="hrng__k" type="button" data-p="0" aria-pressed="true">Huisstijl</button><button class="hrng__k" type="button" data-p="1" aria-pressed="false">Polder</button><button class="hrng__k" type="button" data-p="2" aria-pressed="false">Noordzee</button></div></div>
</div>/* Kleurverloop met ruis · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie */
.hrng{position:absolute;inset:0;overflow:hidden;font-family:'Switzer',sans-serif;--a:#F5480F;--b:#0a0a0a;--c:#f4f3f1;--d:#8a2a0a}
.hrng__fb{position:absolute;inset:0;background:radial-gradient(70% 80% at 20% 75%,var(--a),transparent 70%),radial-gradient(60% 70% at 85% 20%,var(--b),transparent 70%),radial-gradient(50% 60% at 70% 85%,var(--d),transparent 70%),var(--c)}
.hrng canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
.hrng__kies{position:absolute;left:12px;bottom:12px;display:flex;gap:6px}
.hrng__k{font:500 13px/1 'Switzer',sans-serif;padding:7px 10px;min-height:28px;border:1px solid rgba(10,10,10,.15);border-radius:4px;background:rgba(255,255,255,.88);color:#0a0a0a;cursor:pointer;transition:background-color .18s,color .18s}
.hrng__k:hover{background:#fff}
.hrng__k[aria-pressed="true"]{background:#0a0a0a;color:#fff;border-color:#0a0a0a}
.hrng__k:focus-visible{outline:2px solid #F5480F;outline-offset:2px}// Kleurverloop met ruis · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie
// root = het element waarin de HTML staat
function init(root){
var w=root.querySelector('.hrng');if(!w)return;
var reduce=matchMedia('(prefers-reduced-motion: reduce)').matches;
var PAL=[['#F5480F','#0a0a0a','#f4f3f1','#8a2a0a'],['#3f6b3a','#1c2a1a','#e9e4d2','#b8c36a'],['#2f5d7c','#0f1e2a','#dfe7ea','#7fa9b8']];
function rgb(h){return [parseInt(h.substr(1,2),16)/255,parseInt(h.substr(3,2),16)/255,parseInt(h.substr(5,2),16)/255];}
var btns=[].slice.call(w.querySelectorAll('.hrng__k'));var cur=PAL[0].map(rgb),goal=cur.map(function(c){return c.slice();});
var O=window.OGL,probe=document.createElement('canvas'),gl=null,uni,renderer,mesh;
var ok=!!(O&&(probe.getContext('webgl2')||probe.getContext('webgl')));
function setPal(n){btns.forEach(function(b,j){b.setAttribute('aria-pressed',j===n?'true':'false');});
var p=PAL[n];['--a','--b','--c','--d'].forEach(function(v,j){w.style.setProperty(v,p[j]);});
goal=p.map(rgb);if(gl){if(reduce){cur=goal.map(function(c){return c.slice();});push();draw();}else wake();}}
btns.forEach(function(b){b.addEventListener('click',function(){setPal(+b.dataset.p);});});
if(!ok)return;
renderer=new O.Renderer({dpr:Math.min(window.devicePixelRatio||1,1.5),antialias:false});gl=renderer.gl;
gl.canvas.setAttribute('aria-hidden','true');w.insertBefore(gl.canvas,w.querySelector('.hrng__kies'));
var vert='attribute vec2 position; attribute vec2 uv; varying vec2 vUv; void main(){ vUv=uv; gl_Position=vec4(position,0.0,1.0); }';
var frag=['precision highp float;','uniform float uT; uniform vec2 uRes; uniform vec3 uA; uniform vec3 uB; uniform vec3 uC; uniform vec3 uD; varying vec2 vUv;',
'float hs(vec2 p){ return fract(sin(dot(p,vec2(41.3,289.1)))*43758.5453); }',
'float vn(vec2 p){ vec2 i=floor(p); vec2 f=fract(p); vec2 u=f*f*(3.0-2.0*f); return mix(mix(hs(i),hs(i+vec2(1.0,0.0)),u.x),mix(hs(i+vec2(0.0,1.0)),hs(i+vec2(1.0,1.0)),u.x),u.y); }',
'float wt(vec2 p,vec2 c){ vec2 d=p-c; return 1.0/pow(0.015+dot(d,d),1.6); }',
'void main(){ float asp=uRes.x/uRes.y; vec2 p=vec2(vUv.x*asp,vUv.y);',
' vec2 g=vec2(vn(p*1.6+vec2(0.0,uT*0.08)),vn(p*1.6+vec2(7.1,2.3)-uT*0.07))-0.5; p+=g*0.5;',
' vec2 a=vec2(asp*(0.25+0.12*sin(uT*0.23)),0.3+0.16*cos(uT*0.19));',
' vec2 b=vec2(asp*(0.78+0.1*cos(uT*0.17)),0.75+0.12*sin(uT*0.29));',
' vec2 c=vec2(asp*(0.55+0.18*sin(uT*0.13+2.0)),0.12+0.1*sin(uT*0.31));',
' vec2 d=vec2(asp*(0.18+0.1*cos(uT*0.27+1.0)),0.85+0.08*cos(uT*0.21));',
' float wa=wt(p,a); float wb=wt(p,b); float wc=wt(p,c); float wd=wt(p,d);',
' vec3 col=(uA*wa+uB*wb+uC*wc+uD*wd)/(wa+wb+wc+wd);',
' float n=hs(floor(vUv*uRes)+fract(uT*7.0)*vec2(13.0,71.0))-0.5; col+=n*0.07;',
' gl_FragColor=vec4(col,1.0); }'].join(' ');
uni={uT:{value:3},uRes:{value:[1,1]},uA:{value:cur[0]},uB:{value:cur[1]},uC:{value:cur[2]},uD:{value:cur[3]}};
mesh=new O.Mesh(gl,{geometry:new O.Triangle(gl),program:new O.Program(gl,{vertex:vert,fragment:frag,uniforms:uni})});
function push(){uni.uA.value=cur[0];uni.uB.value=cur[1];uni.uC.value=cur[2];uni.uD.value=cur[3];}
function draw(){renderer.render({scene:mesh});}
function size(){var r=w.getBoundingClientRect();if(!r.width||!r.height)return;renderer.setSize(r.width,r.height);uni.uRes.value=[r.width*renderer.dpr,r.height*renderer.dpr];draw();}
var run=false,vis=true,last=0;
function loop(t){if(!vis||reduce){run=false;return;}var dt=Math.min(.05,(t-(last||t))/1000);last=t;uni.uT.value+=dt;
var k=Math.min(1,dt*2.5);cur=cur.map(function(c,j){return [c[0]+(goal[j][0]-c[0])*k,c[1]+(goal[j][1]-c[1])*k,c[2]+(goal[j][2]-c[2])*k];});
push();draw();requestAnimationFrame(loop);}
function wake(){if(!run&&vis&&!reduce){run=true;last=0;requestAnimationFrame(loop);}}
if('ResizeObserver' in window)new ResizeObserver(size).observe(w);size();
if('IntersectionObserver' in window)new IntersectionObserver(function(es){vis=es[0].isIntersecting;if(vis)wake();}).observe(w);
wake();
}
init(document.querySelector('.jouw-container'));
More backgrounds & webgl
Seen something you like?
Add it to your selection and send it over. We build your site around it, in your brand.
Get in touch →