3D Carousel
Een ring van fotokaarten die langzaam in 3D ronddraait. Sleep om hem zelf te draaien (met naloop), of gebruik de pijltjestoetsen om kaart voor kaart te stappen. Voor projecten, vestigingen of teamleden.








Zo gebruik je het
- Plak de HTML op de plek waar het onderdeel moet komen.
- Zet de CSS in je stylesheet. Alle klassen hebben een eigen voorvoegsel, dus niets botst met je eigen opmaak.
- Voeg de JavaScript toe en roep init() aan met het element waar de HTML in staat.
<!-- 3D Carousel · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie -->
<div class="jouw-container">
<div class="h3c3" tabindex="0" role="group" aria-roledescription="carrousel" aria-label="Projecten, sleep of gebruik de pijltjestoetsen">
<div class="h3c3-scene">
<div class="h3c3-ring">
<figure class="h3c3-k"><img src="https://neddev.com/lab-media/carousel-basis-1.webp" alt="" draggable="false"><figcaption>Leiden</figcaption></figure>
<figure class="h3c3-k"><img src="https://neddev.com/lab-media/kaart-carousel-uitklap-1.webp" alt="" draggable="false"><figcaption>Haarlem</figcaption></figure>
<figure class="h3c3-k"><img src="https://neddev.com/lab-media/carousel-basis-2.webp" alt="" draggable="false"><figcaption>Amersfoort</figcaption></figure>
<figure class="h3c3-k"><img src="https://neddev.com/lab-media/kaart-carousel-uitklap-2.webp" alt="" draggable="false"><figcaption>Delft</figcaption></figure>
<figure class="h3c3-k"><img src="https://neddev.com/lab-media/carousel-basis-3.webp" alt="" draggable="false"><figcaption>Zwolle</figcaption></figure>
<figure class="h3c3-k"><img src="https://neddev.com/lab-media/kaart-carousel-uitklap-3.webp" alt="" draggable="false"><figcaption>Noordwijk</figcaption></figure>
<figure class="h3c3-k"><img src="https://neddev.com/lab-media/carousel-basis-4.webp" alt="" draggable="false"><figcaption>Gouda</figcaption></figure>
<figure class="h3c3-k"><img src="https://neddev.com/lab-media/kaart-carousel-uitklap-4.webp" alt="" draggable="false"><figcaption>Utrecht</figcaption></figure>
</div>
</div>
<p class="h3c3-nu" aria-live="polite"></p>
</div>
</div>/* 3D Carousel · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie */
/* fonts (Fontshare): switzer@400,600 */
.h3c3{position:relative;width:100%;height:100%;min-height:220px;box-sizing:border-box;background:#1b1a18;overflow:hidden;cursor:grab;touch-action:pan-y;user-select:none;-webkit-user-select:none;outline:none;font-family:Switzer,sans-serif}
.h3c3:focus-visible{box-shadow:inset 0 0 0 2px #F5480F}
.h3c3.is-sleep{cursor:grabbing}
.h3c3-scene{position:absolute;inset:0;perspective:1100px;perspective-origin:50% 40%}
.h3c3-ring{position:absolute;left:50%;top:46%;width:0;height:0;transform-style:preserve-3d}
.h3c3-k{position:absolute;margin:0;width:var(--h3c3-w,160px);height:var(--h3c3-h,210px);left:calc(var(--h3c3-w,160px) / -2);top:calc(var(--h3c3-h,210px) / -2);border-radius:4px;overflow:hidden;background:#333;backface-visibility:hidden;-webkit-backface-visibility:hidden}
.h3c3-k img{width:100%;height:100%;object-fit:cover;display:block;pointer-events:none}
.h3c3-k figcaption{position:absolute;left:0;right:0;bottom:0;padding:24px 10px 9px;background:linear-gradient(to top,rgba(0,0,0,.7),transparent);color:#fff;font:600 13px/1.2 Switzer,sans-serif}
.h3c3-nu{position:absolute;left:0;right:0;bottom:10px;margin:0;text-align:center;color:#d9d6cf;font:400 13px/1 Switzer,sans-serif}// 3D Carousel · © 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 wrap = root.querySelector('.h3c3'), ring = root.querySelector('.h3c3-ring'), nu = root.querySelector('.h3c3-nu');
var kaarten = Array.prototype.slice.call(root.querySelectorAll('.h3c3-k')), N = kaarten.length, stapH = 360 / N;
var still = window.matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches;
var hoek = 0, snelheid = 0, doel = null, straal = 300, zichtbaar = true, raf = 0, last = 0, sleep = null, rust = 0;
function maat() {
var W = wrap.clientWidth, H = wrap.clientHeight;
var h = Math.min(H * 0.58, 250), w = Math.min(h * 0.76, W * 0.26);
h = w / 0.76;
wrap.style.setProperty('--h3c3-w', w + 'px'); wrap.style.setProperty('--h3c3-h', h + 'px');
straal = (w / 2) / Math.tan(Math.PI / N) + w * 0.18;
wrap.querySelector('.h3c3-scene').style.perspective = Math.max(700, straal * 3.2) + 'px';
teken();
}
function teken() {
ring.style.transform = 'translateZ(' + (-straal) + 'px) rotateY(' + hoek + 'deg)';
var beste = 0, bv = -2;
kaarten.forEach(function (k, i) {
var a = i * stapH, c = Math.cos((a + hoek) * Math.PI / 180);
k.style.transform = 'rotateY(' + a + 'deg) translateZ(' + straal + 'px)';
k.style.filter = 'brightness(' + (0.45 + 0.55 * Math.max(0, c)) + ')';
if (c > bv) { bv = c; beste = i; }
});
var naam = kaarten[beste].querySelector('figcaption').textContent;
if (nu.textContent !== naam) nu.textContent = naam;
}
function lus(t) {
var dt = last ? Math.min(50, t - last) : 16; last = t;
if (!sleep) {
if (doel !== null) { hoek += (doel - hoek) * Math.min(1, dt / 120); if (Math.abs(doel - hoek) < 0.05) { hoek = doel; doel = null; rust = t; } }
else if (Math.abs(snelheid) > 0.002) { hoek += snelheid * dt; snelheid *= Math.pow(0.94, dt / 16); if (Math.abs(snelheid) <= 0.002) rust = t; }
else if (!still && t - rust > 1200) hoek -= 0.006 * dt;
}
teken();
raf = zichtbaar ? requestAnimationFrame(lus) : 0;
}
function start() { if (!raf && zichtbaar) { last = 0; raf = requestAnimationFrame(lus); } }
maat();
if (window.ResizeObserver) new ResizeObserver(maat).observe(wrap);
if ('IntersectionObserver' in window) new IntersectionObserver(function (es) { zichtbaar = es[0].isIntersecting; if (zichtbaar) start(); }).observe(wrap);
start();
wrap.addEventListener('pointerdown', function (e) {
if (e.button !== undefined && e.button > 0) return;
sleep = { x: e.clientX, h: hoek, lx: e.clientX, lt: performance.now(), id: e.pointerId, v: 0 };
doel = null; snelheid = 0; wrap.classList.add('is-sleep'); wrap.setPointerCapture(e.pointerId);
});
wrap.addEventListener('pointermove', function (e) {
if (!sleep || e.pointerId !== sleep.id) return;
var now = performance.now(), dx = e.clientX - sleep.lx, f = 120 / Math.max(240, wrap.clientWidth);
sleep.v = (dx * f) / Math.max(1, now - sleep.lt); sleep.lx = e.clientX; sleep.lt = now;
hoek = sleep.h + (e.clientX - sleep.x) * f;
});
function los(e) {
if (!sleep || e.pointerId !== sleep.id) return;
snelheid = still ? 0 : Math.max(-0.6, Math.min(0.6, sleep.v)); sleep = null; rust = performance.now();
wrap.classList.remove('is-sleep'); start();
}
wrap.addEventListener('pointerup', los);
wrap.addEventListener('pointercancel', los);
wrap.addEventListener('keydown', function (e) {
if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight') return;
e.preventDefault(); snelheid = 0;
var basis = Math.round((doel !== null ? doel : hoek) / stapH) * stapH;
doel = basis + (e.key === 'ArrowRight' ? -stapH : stapH);
if (still) { hoek = doel; doel = null; teken(); }
start();
});
}
init(document.querySelector('.jouw-container'));
Meer uit componenten
Iets gezien dat je mooi vindt?
Zet het in je selectie en stuur hem op. Dan bouwen we je site eromheen, in jouw huisstijl.
Neem contact op →