CSS-only scrollytelling: spiraling every character with sibling-index()
JavaScript-driven scrollytelling sites can produce striking results, but their creators often run into performance limits. The team behind one such site acknowledged that "mobile technically works, but it loses parallax and chops compositions," and chose to gate phones to protect the first impression. The author of another scrolling experiment noted that a text vortex section "would look better if it were applied for each character rather than each word, but that's incredibly difficult to pull off using this same technique without incurring an astronomical performance impact."
That second experiment doubles as a realistic benchmark: smoothly animating hundreds of divs based on scroll position. The question is whether modern CSS can deliver a comparable effect, spiraling each character in a string as the user scrolls, using sibling-index(). At the time of writing, that function is still waiting on Firefox support.
A small amount of script, all of the animation in CSS
The only JavaScript involved splits the text into a <div> per character; the animation itself is pure CSS. Hardcoding the markup would work but makes the HTML hard to read and maintain, so a script keeps the text content easy to experiment with.
const el = document.querySelector(".vortex");
el.innerHTML = el.innerHTML.replaceAll(/\s/g, '⠀');
new SplitText(".title", { type: "chars", charsClass: "char" });
The referenced SplitText plugin comes from the freely available GSAP library and is designed to be usable standalone outside GSAP, which is how it is used here. It also populates aria-label, so screen readers can access the text regardless of how it is tokenized. The one complication was space characters: each needed its own positionable <div>, and the simplest route found was replacing spaces with a special space character, which SplitText places in its own <div>.
.vortex {
position: fixed;
left: 50%;
height: 100vh;
animation-name: vortex;
animation-duration: 20s;
animation-fill-mode: forwards;
animation-timeline: scroll();
.char {
--radius: calc(10vh - (7vh/sibling-count() * sibling-index()));
--rotation: calc((360deg * 3/sibling-count()) * sibling-index());
position: absolute !important;
top: 50%;
left: 50%;
transform: rotate(var(--rotation))
translateY(calc(-2.9 * var(--radius)))
scale(calc(.4 - (.25/(sibling-count()) * sibling-index())));
animation-name: fade-in;
animation-ranger-start: calc(90%/var(sibling-count()) * var(--sibling-index()));
animation-fill-mode: forwards;
animation-timeline: scroll();
}
}
Driving scale, rotation, and distance with sibling functions
sibling-count() and sibling-index() are combined to make several character properties decrease gradually as the index increases, following a formula like this:
propertyValue = startValue - ((reductionValue/totalCharacters) * characterIndex)
The first character starts near the maximum value, and each subsequent character subtracts a slightly larger fraction, so properties dwindle toward a chosen target as the characters spiral inward. That same ratio drives scale, rotation, and distance from the center. For a circular arrangement rather than a spiral, CSS trigonometric functions would be the tool, but the spiral was simpler to calculate without trig, and the original JavaScript version that inspired this CSS text spiral apparently did not use trig either.
The scroll animation itself is uncomplicated: the entire parent element scales and rotates to create the illusion of being pulled into the vortex. Individual characters only receive a fade-in, delayed progressively per character via another variation on the sibling-index()-to-sibling-count() ratio. Here the trick is incrementing animation-range-start to stagger each character's fade as the user scrolls.
Why this matters beyond one effect
The technique resembles the familiar scroll-to-fade pattern, and it highlights how often JavaScript is reached for simply because it allows styling to depend on an element's index. Once sibling-index() reaches Baseline, many JavaScript effects should be reproducible in CSS alone.




