GalleryPremium

Speed Variation

Rows of words streaming the same way, each at its own pace and under its own label: 120 px per second on top, 20 below.

CSSJSSpeed

Updated

This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. Gallery has 44 effects, including 6 free. Explore the category →

3 usage examples

Villages passed, on three planes of depth — top of the page of a mountain tourist train — Speed Variation example 1

① Villages passed, on three planes of depth — top of the page of a mountain tourist train

WhenOn the Cimavrelle home page, a drawn carriage window shows three rows of names: the summits, small and slow, “far off”; the hamlets “halfway up”; the stations “by the track”, very large and very fast.
WhyIt is what you get behind a train window: what is near rushes by, what is far lingers. Three speeds and three sizes are enough to give depth, without a single photo.
Settingsdata-speed="14", "40" and "118" on the three rows; --spmq-size redefined on each .spmq-row (13, 21 and 36 px); --spmq-space: 34px; pointer-events: none on .spmq-rows so the mouse does not freeze the landscape; Pause button moved up into the corner of the window.
Fibre versus ADSL, speed shown by the scrolling — plan page of a member-owned internet provider — Speed Variation example 2

② Fibre versus ADSL, speed shown by the scrolling — plan page of a member-owned internet provider

WhenAt the foot of the Ondelierre plan (€32 a month), two rows carry the same files — holiday film, wedding photos, 6 pm video call: in blue at 170 px/s under “Fibre · 1 Gb/s”, in beige at 12 px/s under “ADSL · 8 Mb/s”.
WhyA bit rate in megabits means nothing to many people; two paces side by side do. The labels give the real figures, and a note states that the gap shown is not to scale (it would be 1 to 125).
Settingsdata-speed="170" and "12"; --spmq-size: 11.5px, --spmq-space: 8px, --spmq-color-1: #fff, --spmq-color-2: #5a3a2c; each <li> as a rounded pill; bold labels with the download time.
Choosing the speed of scrolling text — settings of a display app for shop windows — Speed Variation example 3

③ Choosing the speed of scrolling text — settings of a display app for shop windows

WhenIn Pancartel, the baker sets up the screen in his window. Three options, “Slow”, “Normal”, “Fast”: under each, his message (“Sourdough baked this morning”) scrolls at the pace on offer, 30, 60 or 120 px/s.
WhyYou choose by seeing, not by guessing what “60 px/s” is worth. The row label becomes the form option. The radio button and its orange frame belong to the app: the effect only brings the three previews.
Settingsdata-speed="30", "60", "120"; a <label> with a radio button inside each .spmq-label; --spmq-size: 12px, --spmq-space: 22px, both colours at #ffd98a; 24 px windows on a dark background; pointer-events: none on the rows, except the labels.

How it works

Each .spmq-row carries its speed in its data-speed attribute, in pixels per second: 120 for the first, 20 for the second in the demo. A row without the attribute takes the value written on the root (60). The script works out one duration per row: the fast list, 532 px long, loops in 4.4 seconds; the slow one, 538 px, in 27 seconds.

Above each row, a .spmq-label paragraph names it: “FAST”, “SLOW”, or whatever the speed means in your case. It is ordinary, still text that you can enrich (a value, a unit, a checkbox) or remove.

All rows head left: the only thing that tells them apart at a glance is their pace. Their colours alternate between --spmq-color-1 (odd rows) and --spmq-color-2 (even rows). Add as many .spmq-row blocks as you need; data-direction="right" on one of them turns it round.

The block is controlled in one move: resting the mouse on the rows stops them all, and so does the round button.

Accessibility

  • One button for the whole block: aria-pressed turns to true and every row freezes; it is reached with Tab and answers Space, Enter and a finger tap.
  • Labels are read: each .spmq-label is a paragraph placed before its list; a screen reader therefore announces it right before the row's items, read once (the copies carry aria-hidden="true").
  • Speed cannot be heard: if the pace carries information (a bit rate, a level), also write it out in the label.
  • Speed and reading: at 120 px/s a word crosses a 390 px phone screen in a little over 3 seconds. Keep that pace for short words or decoration, and put useful text on a slow row.
  • Animations switched off by the user: the rows stay still under their labels, each scrollable by hand; the button disappears, since there is nothing left to stop.

Browser compatibility

One CSS animation per row, whose duration is written by the script, 5 KB, no dependency. The space between rows comes from flexbox gap (Chrome 84, Firefox 63, Safari 14.1); recounting on resize comes from ResizeObserver (Chrome 64, Firefox 69, Safari 13.1). Measured on 4 December 2026 in Chromium, Firefox and WebKit: 120 and 20 px/s found when measured (119 to 124 and 20 to 21 depending on the moment), full rows at 390 and 1,900 px, two independent blocks in one page.

Chrome 86+✓ Full (measured)
Firefox 85+✓ Full (measured)
Safari 15.4+✓ Full (WebKit engine measured)
Edge 86+✓ Full (Chromium engine)
iOS Safari 15.4+✓ Not verified on a device
Android Chrome 86+✓ Full (emulated touch, measured)

If the script does not run, each row shows its list once, still, under its label. Before Safari 14.1 or Chrome 84 the rows touch each other (no gap): give them a margin.

The code

HTML structure to paste into your page (the CSS + JS come with your purchase):

index.html — structure
<div class="fx-0191-root" data-speed="60">
  <div class="spmq-band">
    <div class="spmq-rows">
      <div class="spmq-row" data-speed="120">
        <p class="spmq-label">FAST</p>
        <div class="spmq-viewport">
          <div class="spmq-track">
            <ul class="spmq-group" role="list">
              <li>…</li>
            </ul>
          </div>
        </div>
      </div>
      <div class="spmq-row" data-speed="20">
        <p class="spmq-label">SLOW</p>
        <div class="spmq-viewport">
          <div class="spmq-track">
            <ul class="spmq-group" role="list">
              <li>…</li>
            </ul>
          </div>
        </div>
      </div>
    </div>
    <button type="button" class="spmq-toggle" aria-pressed="false" aria-label="Pause"></button>
  </div>
</div>

One-time payment, no subscription — the code is yours forever

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
data-speed on a .spmq-row 120 / 20 Pace of that row, in pixels per second.
data-speed on the root 60 Pace of the rows that do not have their own.
.spmq-label (HTML) FAST / SLOW Label above a row; free text, or to be removed.
--spmq-color-1 / --spmq-color-2 #f43f5e / #10b981 Colour of odd and even rows; redefined on one row, it only applies to that row.
--spmq-size / --spmq-space 1.25rem / 4rem Text size and white space between two words, for the whole block or row by row.
data-direction on a .spmq-row absent (left) right sends that row to the right.
--spmq-height / --spmq-bg / --spmq-padding 180px / #0a0a0f / 1rem 0 Minimum height, background and inner padding of the block.
--spmq-button / --spmq-button-size rgba(255, 255, 255, .8) / 2rem Look of the shared Pause button.

FAQ

The starting choice. Alternating Rows contrasts directions: every other row heads right, all at the same pace, in three colours, with no label. Speed Variation keeps a single direction, contrasts paces and names each row. Both take data-speed and data-direction per row: you can turn one into the other by adjusting; pick the one that needs the least reworking.
Copy a whole .spmq-row block, change its data-speed and its list. The third row takes the colour of the first; to give it one of its own, redefine the variable on that row: .spmq-row:nth-child(3) { --spmq-color-1: #38bdf8; }. Size is set the same way with --spmq-size.
Add pointer-events: none on .spmq-rows: hovering is no longer detected, the rows keep going under the mouse. The Pause button, placed outside that block, stays clickable; keep it, since it is what lets people stop the motion.