Text Along Path
A sentence runs endlessly along a wavy line and speeds up while you hover over it. As a ribbon above a hero or as a transition between two sections; with reduced motion the text stands still.
How to use it
- Paste the HTML where the text animations should appear.
- 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.
<!-- Text Along Path · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie -->
<div class="jouw-container">
<div class="tap">
<svg class="tap__svg" viewBox="0 0 1000 480" preserveAspectRatio="xMidYMid slice" role="img" aria-label="Van ontwerp tot oplevering, interieurbouw in heel Zuid-Holland">
<path class="tap__lijn" d="M-80 340C120 110 330 90 500 250S860 410 1080 160"/>
<text class="tap__tekst" aria-hidden="true"><textPath class="tap__pad">Van ontwerp tot oplevering · interieurbouw in heel Zuid-Holland · </textPath></text>
</svg>
</div>
</div>/* Text Along Path · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie */
.tap{position:relative;width:100%;height:100%;overflow:hidden;background:#fff;font-family:'Switzer',sans-serif}
.tap__svg{position:absolute;inset:0;width:100%;height:100%;display:block;overflow:hidden}
.tap__lijn{fill:none;stroke:#e4e0da;stroke-width:2;stroke-dasharray:6 10}
.tap__tekst{font-family:'Switzer',sans-serif;font-size:46px;font-weight:600;fill:#0a0a0a;letter-spacing:-.005em}
.tap:hover .tap__tekst{fill:#F5480F;transition:fill .2s ease}// Text Along Path · © 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('.tap'); if (!w) return;
var lijn = w.querySelector('.tap__lijn'), tp = w.querySelector('.tap__pad'), tekst = w.querySelector('.tap__tekst');
var id = 'tap-' + Math.random().toString(36).slice(2, 9);
lijn.setAttribute('id', id);
tp.setAttribute('href', '#' + id); tp.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#' + id);
var eenheid = tp.textContent, lengte = lijn.getTotalLength();
var reeks = eenheid; while (reeks.length < eenheid.length * 6) reeks += eenheid;
tp.textContent = reeks;
var stuk = 0;
try { stuk = tekst.getComputedTextLength() * eenheid.length / reeks.length; } catch (e) {}
if (!stuk) stuk = lengte / 2;
var rustig = window.matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches;
var pos = -stuk * 0.35;
tp.setAttribute('startOffset', pos.toFixed(1));
if (rustig) return;
var snel = 40, doel = 40, vorig = 0, zichtbaar = false, loopt = false;
w.addEventListener('pointerenter', function(){ doel = 170; });
w.addEventListener('pointerleave', function(){ doel = 40; });
function lus(nu){
if (!zichtbaar){ loopt = false; return; }
var dt = Math.min(0.05, (nu - (vorig || nu)) / 1000); vorig = nu;
snel += (doel - snel) * Math.min(1, dt * 4);
pos -= snel * dt; if (pos < -stuk) pos += stuk;
tp.setAttribute('startOffset', pos.toFixed(1));
requestAnimationFrame(lus);
}
function aan(){ if (!loopt){ loopt = true; vorig = 0; requestAnimationFrame(lus); } }
if ('IntersectionObserver' in window) new IntersectionObserver(function(e){ zichtbaar = e[0].isIntersecting; if (zichtbaar) aan(); }).observe(w);
else { zichtbaar = true; aan(); }
}
init(document.querySelector('.jouw-container'));
More text animations
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 →