WebGL kleurveld
A living colour field from black to orange that flows slowly and bends away under the cursor, with headline and button on top; for an opening that moves without loading a video.
How to use it
- Paste the HTML where the hero styles 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.
<!-- WebGL kleurveld · © 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="hrwg"><div class="hrwg__fb" aria-hidden="true"></div><div class="hrwg__txt"><p class="hrwg__h">Websites die gewoon werken</p><p class="hrwg__s">Ontwerp en bouw voor bedrijven in de Randstad.</p><a class="hrwg__btn" href="#">Plan een kennismaking</a></div></div>
</div>/* WebGL kleurveld · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie */
.hrwg{position:absolute;inset:0;overflow:hidden;background:#0a0a0a;container-type:size;font-family:'Switzer',sans-serif}
.hrwg__fb{position:absolute;inset:0;background:radial-gradient(60% 70% at 72% 30%,#F5480F 0%,rgba(245,72,15,0) 70%),radial-gradient(50% 60% at 20% 85%,#6b1705 0%,rgba(107,23,5,0) 70%),#0a0a0a}
.hrwg canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
.hrwg__txt{position:absolute;left:0;right:0;bottom:0;padding:0 7cqw 7cqh;background:linear-gradient(to top,rgba(10,10,10,.55),rgba(10,10,10,0));pointer-events:none}
.hrwg__h{margin:0;color:#fff;font-weight:700;font-size:clamp(20px,7.4cqw,64px);line-height:1.02;letter-spacing:-.025em;max-width:12ch}
.hrwg__s{margin:1.6cqh 0 3.4cqh;color:rgba(255,255,255,.82);font-size:clamp(12px,2.6cqw,18px);line-height:1.4}
.hrwg__btn{pointer-events:auto;display:inline-block;background:#fff;color:#0a0a0a;text-decoration:none;font-weight:600;font-size:clamp(12px,2.4cqw,16px);padding:.75em 1.1em;border-radius:4px;transition:background-color .18s,color .18s}
.hrwg__btn:hover,.hrwg__btn:focus-visible{background:#F5480F;color:#fff}
.hrwg__btn:focus-visible{outline:2px solid #fff;outline-offset:3px}
@media (max-width:420px){.hrwg__s{display:none}.hrwg__h{margin-bottom:10px}}// WebGL kleurveld · © 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('.hrwg');if(!w)return;
var reduce=matchMedia('(prefers-reduced-motion: reduce)').matches;
var btn=w.querySelector('.hrwg__btn');btn.addEventListener('click',function(e){e.preventDefault();});
var O=window.OGL;var probe=document.createElement('canvas');
var ok=!!(O&&(probe.getContext('webgl2')||probe.getContext('webgl')));
if(!ok)return;
var renderer=new O.Renderer({dpr:Math.min(window.devicePixelRatio||1,1.5),antialias:false});
var gl=renderer.gl;gl.canvas.setAttribute('aria-hidden','true');w.insertBefore(gl.canvas,w.querySelector('.hrwg__txt'));
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 vec2 uM; uniform float uMI; varying vec2 vUv;',
'float hs(vec2 p){ p=fract(p*vec2(233.34,851.73)); p+=dot(p,p+23.45); return fract(p.x*p.y); }',
'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 fb(vec2 p){ float v=0.0; float a=0.5; mat2 r=mat2(0.8,0.6,-0.6,0.8); for(int i=0;i<5;i++){ v+=a*vn(p); p=r*p*2.03+vec2(3.1,1.7); a*=0.5; } return v; }',
'void main(){ float asp=uRes.x/uRes.y; vec2 p=(vUv-0.5)*vec2(asp,1.0)*2.4; vec2 m=(uM-0.5)*vec2(asp,1.0)*2.4;',
' vec2 dm=p-m; float d2=dot(dm,dm); p+=dm*uMI*0.55*exp(-d2*1.4);',
' vec2 q=vec2(fb(p+vec2(0.0,uT*0.06)),fb(p+vec2(5.2,1.3)-uT*0.05));',
' float f=fb(p+2.2*q+vec2(uT*0.035,0.0));',
' vec3 ink=vec3(0.039); vec3 deep=vec3(0.40,0.08,0.02); vec3 ora=vec3(0.961,0.282,0.059); vec3 sand=vec3(0.957,0.953,0.945);',
' vec3 c=mix(ink,deep,smoothstep(0.25,0.62,f)); c=mix(c,ora,smoothstep(0.5,0.85,f+q.x*0.35)); c=mix(c,sand,smoothstep(0.86,1.12,f+q.y*0.4)*0.3);',
' c+=ora*0.22*uMI*exp(-d2*2.5); vec2 v=vUv-0.5; c*=1.0-0.4*smoothstep(0.25,0.9,length(v*vec2(1.0,1.3)));',
' gl_FragColor=vec4(c,1.0); }'].join(' ');
var uni={uT:{value:7.0},uRes:{value:[1,1]},uM:{value:[0.5,0.5]},uMI:{value:0}};
var prog=new O.Program(gl,{vertex:vert,fragment:frag,uniforms:uni});
var mesh=new O.Mesh(gl,{geometry:new O.Triangle(gl),program:prog});
w.classList.add('is-gl');
function size(){var r=w.getBoundingClientRect();if(!r.width||!r.height)return;renderer.setSize(r.width,r.height);uni.uRes.value=[r.width,r.height];draw();}
function draw(){renderer.render({scene:mesh});}
var tx=.5,ty=.5,mx=.5,my=.5,inside=0,mi=0,run=false,vis=true,last=0,raf=0;
w.addEventListener('pointermove',function(e){var r=w.getBoundingClientRect();tx=(e.clientX-r.left)/r.width;ty=1-(e.clientY-r.top)/r.height;inside=1;if(reduce)step(performance.now());else wake();});
w.addEventListener('pointerleave',function(){inside=0;if(reduce){mi=0;uni.uMI.value=0;draw();}else wake();});
function step(t){var dt=Math.min(.05,(t-(last||t))/1000);last=t;
if(!reduce)uni.uT.value+=dt;
var k=reduce?1:Math.min(1,dt*5);mx+=(tx-mx)*k;my+=(ty-my)*k;mi+=(inside-mi)*(reduce?1:Math.min(1,dt*3));
uni.uM.value=[mx,my];uni.uMI.value=mi;draw();}
function loop(t){raf=0;if(!vis||reduce){run=false;return;}step(t);raf=requestAnimationFrame(loop);}
function wake(){if(!run&&vis&&!reduce){run=true;last=0;raf=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 hero styles
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 →