03 / MOTION
Motion
Every animation on kirupa.com: what moves, when it stops, how readers turn it off, and how to build and test new motion.
Agent Instructions / motion
You are adding or changing motion on KIRUPA. Read /design/sections/motion.md first. Reuse an existing vocabulary: the header sky, the kirupaBot launcher, background icons (motion.js, also on the forum), content reveals (reveal.js), or the home page's icons, tour, and section reveal. Add a new one only for clear orientation, feedback, or delight, with one owner, a still state, a reduced-motion path, and an off switch, ideally a Customize Theme choice. Keep decorative layers aria-hidden, pointer-transparent, out of print and forced colors, and outside the text column. Never hold back or move text being read, code, tables, embeds, forms, quiz UI, or live demos; mark labs, games, and runnable examples with data-live-demo, and opt out with data-reveal-skip, data-motion-avoid, data-motion, or data-reveal. Animate only opacity and transform, read layout only when a scroll settles, stop work offscreen and in hidden tabs, and treat anchors, same-page links, Home and End, the scrollbar, scripts, find in page, and focus as jumps that show content at once. Verify in WebKit and Chromium with trackpad-style wheel flicks, reduced motion, no JavaScript, jumps, keyboard focus, and print; run tools/motion.browser.mjs; and compare CLS, long tasks, and input latency with the layer off. Bump the footer's v keys with every motion file change, never reference or request a new ?v= key before its upload, and republish the forum from discourse/ after background icon changes. Previews pause locally and offscreen, and never change saved preferences. Sound stays off unless explicitly requested. Follow WCAG 2.2 AA for new or changed content: semantic HTML, keyboard access, visible focus, readable contrast in every theme, text alternatives, labeled controls, and explicit errors. Support zoom/reflow, respect reduced motion, and keep sound optional. Read /design/sections/accessibility.md for acceptance checks. Report unresolved barriers; automated checks alone do not establish conformance.
KIRUPA moves for orientation and a little delight, never at the cost of reading. Every moving thing has one owner, a still state, and a way to turn it off. These are the motion vocabularies on the site:
| Vocabulary | Where | What moves | Turns off with |
|---|---|---|---|
| Header sky | Every page on the current design | Clouds on 60-300s loops, plus each style's own art | Reduced motion |
| kirupaBot launcher | Every page with kirupaBot | A 5.333s float, a 5s bounce, and a 5s icon turn | Reduced motion |
| Background icons | Beside the text column where there's room, on kirupa.com and the forum | The reader's style icons, moved by scrolling | Customize Theme > Background icons, or reduced motion (Still) |
| Content reveals | Blocks that start below the window, except on the forum | Opacity and a short rise, once per block | Customize Theme > Content reveals, or reduced motion |
| Home page icons | The home page's opening | Up to 12 icons that wander and dance | Background icons > Off or Still, or reduced motion |
| Home page tour | The home page's "Ever wondered..." questions | A new question every 5.5s | Hover or focus holds it; Off, Still, or reduced motion stops it |
| Home page reveal | The home page's sections | A 24px rise over 0.7s, 70ms apart | Content reveals > Off, or reduced motion |
| Sketch header | The Sketch header's page of sketches | Stepped, flip-book loops: the cloud drifts, the sun's rays turn and breathe, the gears tick, the robot shuffles and tilts its head, steam curls, the lamp flickers, the arm sways, and the paper plane bobs | Reduced motion; paused offscreen or in a hidden tab |
| 3D page tilt | Article headings, callouts, code, and cards, in the 3D style | A tilt of up to 2.5 degrees toward the mouse, as if the page were a tray in your hands | Touch, or reduced motion |
| Who's Online globe | Who's Online | A slowly turning globe | Reduced motion |
| 404 dancers | The 404 page | Style icons dancing behind the message | Reduced motion |
Customize Theme opens from every page's header. Its Background icons and Content reveals groups govern the site-wide layers, and the home page follows them too. The forum's Customize Theme has the Background icons group only.
Header sky and kirupaBot
The shared header moves five clouds with transform, on linear loops of 60, 80, 100, 300, and 200 seconds that each start at a random point.
Style scripts add Sci-Fi's moving atlas, Ukiyo-e's sails, birds, and mist, Plakat's band of flat shapes and the shape in front of each section heading, and 3D's floating toys, which bob and lean toward the pointer; 3D also tilts the page's headings and cards a few degrees toward a mouse. It writes the angle only on the elements on screen (writing it on <html> would restyle the whole page every frame), and a block still revealing waits until it lands.
Minimal's reading line and Terminal's status-line percentage follow article scroll instead of looping; Terminal's block cursor blinks. Every style's stylesheet stops its keyframes for reduced motion. You can see the sky on the homepage and inspect its real animation here:
Sky and navigation motion
LOCAL PREVIEWActivate this specimen to load its real styles. No saved preferences change.
The kirupaBot launcher floats on a 5.333s loop while its icon bounces and turns on 5s loops. Hover and press stop the float and push the button into its hard shadow, and the panel opens with a short reveal; chat messages arrive in 0.18s steps and the typing dots blink each second. Theme variants change the material and easing, never whether the control stays findable and clickable. Reduced motion stops every loop. Neither the sky nor the launcher has an on-page pause yet: reduced motion is their only off switch.
Background icons
Background icons put a few of the reader's own style icons in the empty space beside the text column, moved by scrolling. They never cover the words. kirupa.js loads motion.js and motion.css after the page has loaded, only where icons can show. The layer keeps these clearances:
- Each margin is a lane from 16px inside the window's edge to 28px from the column. A lane narrower than 64px is dropped.
- A rail beside the column narrows its lane when it's taller than 60% of the window (fixed) or half the column (on the page).
- The topic and forum rails, the end-of-article sign-off, the kirupaBot launcher, the onboarding card, the search status, and anything marked
data-motion-avoidkeep 16px of clearance when fixed and 20px on the page. - Images, figures, SVGs, tables, code, iframes, video, and canvases that spill past the column keep 20px. Only the column's first three levels are checked, at most 600 elements.
- The docked orange keeps 18px, and icons stay below the header art and 12px inside the column's top and bottom, so they never reach the newsletter or footer.
kirupa.jsskips the download when neither side of the column has 108px, and loads it if a resize makes room.
The art is the reader's own style set, from the same kirupaTwemojiSets and kirupaTwemojiNames map the header uses, like the 404 page's dancers:
| Style | Set | Art used |
|---|---|---|
| Plakat | plakat | 72px PNGs; plakatDark light-ink art on dark pages |
| Pixel and Terminal | pixel-twemoji-16 | 128px PNGs at 32px or 48px, on whole pixels; Terminal's as 1-bit outlines in its foreground |
| Smooooth | smooooth | 72px PNGs |
| Sci-Fi | scifi-twemoji | 72px PNGs |
| Minimal | minimal-twemoji | 72px PNGs; minimalDark light-ink art on dark pages |
| Ukiyo-e | ukiyoe-twemoji | 72px PNGs |
| Sketch | sketch | 72px PNGs |
| 3D | 3d | 72px PNGs |
The 144px sets swap to their 72px copies, which saves most of the bytes (Smooooth: about 21 KB down to 7 KB an icon). Each page draws from one pool: AI pages (30 icons), code topics (26), quizzes (19), Learn (14), or the site pool (16). The order is a shuffle seeded by the page's path, so a page always gets the same icons in the same places. An icon a set lacks tries another icon twice, then shows the original /icon/<code>.svg. html[data-motion-section] picks a pool, and html[data-motion-icons] lists codes of its own.
Readers choose the details in Customize Theme > Background icons. Only choices that differ from the defaults are stored, so readers who never change anything follow future defaults:
| Setting | Choices | Default | What it sets |
|---|---|---|---|
| Motion | Off, Still, Calm, Playful, Lively, Drift | Playful | How the icons move, below |
| Icons | Sparse, Some, Lots | Some | One icon per 120,000, 68,000, or 38,000 square pixels of lane |
| Strength | Faint, Soft, Bold | Faint | Opacity 0.22, 0.34, or 0.52 |
| Lines | On, Off | On | Bonds between nearby icons |
| Drift rests | After 3s, Never | After 3s | Whether Drift stops 3s after scrolling |
Each Motion choice has its own model. Depth is how far an icon travels for each pixel scrolled: 1 moves with the page, and smaller values lag behind it:
| Motion | Depth | Moves | Settles |
|---|---|---|---|
| Off | None | Nothing; the layer is hidden | Not applicable |
| Still | 1 | With the page, like stickers; no script runs while scrolling | Always still |
| Calm | 0.2 to 0.5 | Slower than the page while you scroll | The moment you stop |
| Playful | 0.28 to 0.6 | Lags, tilts up to 9 degrees, and springs back | Within about a second |
| Lively | 0.28 to 0.58 | Dances while you scroll | 1.2s after the last scroll |
| Drift | 0.28 to 0.58 | Wanders and dances on its own, like the home page's icons | 3s after you stop, unless Drift rests is Never |
Playful's spring adds 0.38 x depth x each frame's scroll distance to an offset capped at 42px, pulls it back with a stiffness of 85 + 40 x depth and a damping of 11, and stops below 0.08px and 0.6px a second. Its tilt is 0.035 degrees per px/s of spring speed.
Lively and Drift dance with five keyframe sets (an 8px bob, a 9-degree sway, a 12px hop, a jelly squash, and a shimmy) on 1.1-2.4s beats; Drift also wanders 10px and 4 degrees on 6-13s loops.
A jump of more than a window, such as an anchor or the End key, moves everything at once without a wobble. Pixel keeps icons on whole pixels and never tilts them. Only Drift moves on its own; the others move only while you scroll.
Each lane splits into one to four sub-columns, one per 110px, each at its own depth, so neighbors slide past each other and the lines form and break. A lane gets round(lane width x (window height + 144) / density) icons, at least 1 and at most 16, on a window-sized strip that wraps around as you scroll, so a long page costs no more than a short one and a window shows at most 32.
Still places icons down the page instead, at the same density, at most 120. It measures their pitch once, spreading them out when a page is too long for 120, and keeps it until the margins or the number of icons change; each slot draws random numbers of its own. A page that grows only gains icons below the ones it has, and a window that changes height moves none.
The script runs one requestAnimationFrame loop only while scrolling or settling: it stops once every spring rests, three frames pass without scrolling, and 100ms pass after the last scroll event. Icons have these sizes, opacities, and lines:
- Icons are 26-42px below 1100px wide and 30-52px wider, nearer ones bigger, at most 56px and never wider than their sub-column less 8px. Pixel uses 32px or 48px.
- Opacity is the Strength value x 0.82-1.18 by nearness, x 1.15 on dark pages (Minimal: x 0.9 light, x 1 dark), with saturation at 0.7 (Smooooth 0.75, Sci-Fi 0.8, Minimal 1). The layer fades in over 1.2s, and icons fade over 0.35s as they meet an obstacle or move to a new spot.
- Lines join icons in the same lane that are less than 170px apart and more than 10px past their edges, at most two per icon, like atoms. They strengthen from 170px to 94px apart and fade out within 30-110px of the window's top and bottom.
- Pixel and Terminal draw dotted 2px lines on whole pixels (Terminal's in its foreground color), Plakat straight solid 1.25px hairlines in its ink, Smooooth 1.75px curves, Sci-Fi 1px dashed traces in its frame color, Minimal 1px hairlines in the text color, Ukiyo-e 1.25px brushed curves, Sketch quick 1.5px pen lines in its ink, and 3D soft, rounded 3px strings in its accent.
The layer lays out again when the window resizes, when the page or the column changes size (150ms after it settles), when the style, color, or mode changes, when fonts load, and 1.5s after it starts.
A layout that leaves an icon's spot alone leaves the icon alone, mid-spring and mid-tilt included, so content arriving while you scroll, such as an image or the forum's next topics, never snaps an icon back. When a resize or a new choice does move icons, each one on screen fades out where it was while it fades in at its new spot; reduced motion skips the fade.
This specimen runs the production motion.js and motion.css under the footer's cache key, beside the site's real tutorial grid in a 1280 x 800 window scaled to fit. Its controls use Customize Theme's choices but change only this preview, and the line below them reports what the layer is doing. Scroll inside it; Pause motion, like scrolling it out of view, shows the reduced-motion state:
Background icons
LOCAL PREVIEWActivate this specimen to load its real styles. No saved preferences change.
kirupaBackgroundIcons.status() says why the icons are or aren't showing, and Customize Theme turns it into the hint under its choices:
| status() | Meaning |
|---|---|
| waiting-for-load, waiting | The page hasn't finished loading and gone idle yet |
| loaded | motion.js is running |
| off | Motion is Off |
| switched off | The footer's rollback switch is off |
| classic page | The page uses the old stylesheet |
| page | A quiz (#quizApp, .quizStage), kirupaBot's chat page (.kb-chat-shell), the icon-field home page previews ([data-hp-hero]), a page with its own motion (html[data-motion], .kmotion), or no text column |
| data saver | The browser asks to save data |
| forced colors | High-contrast colors are on |
| demo | The page has a live demo |
| narrow | Neither side of the column has 108px |
A page has a live demo when anything is marked data-live-demo, or its column holds a canvas, an autoplaying video, an iframe other than a YouTube video or forum comments, an object or embed (Flash and Silverlight examples), a Ruffle player, a .swfPlayer, a .codepen, a range slider, an output, role="application", or a looping animation already running. Background icons and content reveals share this check and both stand down. Reduced motion doesn't block the icons; it turns every choice into Still.
The layer is aria-hidden, takes no pointer events or keyboard focus, never anchors scrolling, and is hidden in print and forced colors. Its interfaces are:
window.kirupaBackgroundIcons(owned bykirupa.js; the footer definesonandv):options,defaults,settings(),save(changes),load(), andstatus().window.kirupaMotion(frommotion.js):get()returns the settings pluseffective,reason,count,lanes, andreducedMotion;relayout()anddebug()serve tests.- Events:
kirupa:backgroundiconswhen a choice changes (detail: the settings) andkirupa:motionchangewhen the layer changes (detail:get()). - Storage:
kirupaBackgroundIconsholds only non-default choices as JSON. Icon names come with the pools (code#name), so nothing caches a name map. - An address can try settings for one view, as in
?motion=calm&icons=lots; saving a choice clears them. - Rollback: set
kirupaBackgroundIcons.onto false infooter.shtml. Bump itsvafter changingmotion.jsormotion.css.
Background icons on the forum
The forum runs the same layer in all six of its themes. discourse/motion-source.mjs copies the Background icons block from kirupa.js, plus motion.js and motion.css, into the forum's KIRUPA Theme Selector when its themes are built, so the presets, defaults, events, and status() match the site's. kirupa-forum-motion.js supplies what differs on Discourse:
- The column is Discourse's content wrapper,
#main-outlet-wrapper: the sidebar, topics, timeline, and banner. It's 1350px wide with the sidebar and 1110px without, so the 108px room check passes only in windows about 1570px and wider, or about 1330px with the sidebar hidden. Hiding the sidebar loads the icons without a resize, and showing it clears them; phones and narrower windows load nothing. - Icons keep clear of the sticky header, Pixel's header sky, the composer, the chat drawer, the onboarding card, and anything marked
data-motion-avoid. Modals, menus, the lightbox, and Customize Theme open above them. status()reportspageon admin pages and full-page chat, anddemowhen a post holds a live demo, using the site's check on the posts each time Discourse changes page. Reduced motion, data saver, forced colors, and print work as on kirupa.com.- Every forum page uses the site icon pool. The art comes from kirupa.com's absolute URLs, and the name map is bundled, since kirupa.com's has no cross-origin access.
- Choices are saved per browser as
kirupaForumBackgroundIcons, apart from kirupa.com'skirupaBackgroundIcons, and Reset to default clears them. - The forum has no content reveals, and its Customize Theme leaves out the Content reveals group.
- The selector's
kirupa_background_iconstheme setting, on by default, removes the layer and its choices for everyone and keeps readers' saved choices. discourse/tests/motion.mjschecks it, including content arriving mid-scroll: runnpm run test:browser -- --state <state.json> --published --motion-onlyindiscourse/, in Chromium and again with--browser webkit.
Content reveals
Content reveals fade blocks of a page up the first time they scroll into view, like the home page's sections. kirupa.js loads reveal.js and reveal.css after the page has loaded, and readers choose in Customize Theme > Content reveals:
| Choice | What moves | Duration | Rise | Stagger | Starts |
|---|---|---|---|---|---|
| Off | Nothing | None | None | None | Never |
| Figures only | Images, SVG diagrams, pictures, and figures, never words | 400ms | 8px, growing from 94% | None | When any part is in view |
| All sections (default) | Every block | 700ms | 24px | 70ms, at most 4 steps (280ms) | When it's 8% of the window above the bottom edge |
Both animate only opacity and a transform, with the home page's cubic-bezier(.2, .7, .2, 1) easing. A block counts as a figure when it is one, or holds one and no text. All sections' 700ms is longer than the 500ms NN/g found reads as slow; it matches the home page by choice.
These guarantees hold on every page:
- Progressive: the HTML and stylesheet hide nothing. Only blocks below the window at the first measurement are held, so without JavaScript, for crawlers, and in print, the page is complete.
- Above the fold never animates, and neither does anything above the window or peeking into it, counting an image that overhangs its block.
- Each block reveals once and is then forgotten.
- Stopping shows anything still held on screen, with its reveal: on
scrollend, with a 400ms fallback, or 200ms after the last scroll wherescrollendisn't supported. - A block arriving from above, or with its top in the top 35% of the window, shows at once.
- A held block takes no clicks, so a press can't focus a link that's about to move.
- Screen readers read held text; opacity never hides it from them.
Scrolling the reader does reveals as it goes. Anything else that moves the page is a jump, which shows what it lands on at once until the reader scrolls again:
| Input | Result |
|---|---|
| Trackpad or mouse wheel, momentum included | Reveals as it goes |
| Touch | Reveals as it goes |
| Arrow keys, Page Up, Page Down, and Space | Reveal as they go |
| Opening at an anchor | Shows at once for the first 1.5s |
| A link to a spot on the same page, even a smooth one | Shows at once |
| Home, End, and Cmd+Up or Cmd+Down | Shows at once |
| More than 80% of a window in one step, without reader input in the last second | Shows at once |
| The scrollbar, autoscroll, or a script | Shows at once after 40ms of scrolling with no reader input in the last half second |
| Find in page (Ctrl or Cmd+F, Ctrl or Cmd+G, F3) | Shows everything |
| Keyboard focus on a held block | Shows that block |
| Printing | Shows everything |
| Hiding the tab | Finishes every fade in progress |
The fast-scroll guard is off. Showing blocks at once above 2,400px a second skipped most reveals, because ordinary trackpad flicks pass that speed: a flick on the AI agent article peaked near 3,600px a second in WebKit. The wheel and touch listeners are passive, and the capturing key listener never calls preventDefault, so nothing holds up a scroll.
Code, tables, embeds, canvases, video, audio, Flash and Ruffle players, CodePens, syntax-highlighted blocks, forms and form controls, meters, progress bars, quiz UI, kirupaBot, the background icons, the onboarding card, dialogs, details, and anything hidden, fixed, sticky, already transformed, or already animating are never held. A wrapper that holds one of them is opened instead, so its other children still reveal.
Interactive widgets are found from their parts up, so nothing a reader is using moves or waits:
- A part is a form, an
output, a live region, a widget role (status,log,alert,timer,marquee,progressbar,application,toolbar,tablist,tabpanel,grid,treegrid,tree,listbox,menu,menubar, orradiogroup), anything markeddata-live-demo, kirupaBot's chat, or a control: a button, input, select, textarea, editable region, or control role. - Hidden parts don't count, and neither does a lone copy or run button beside a code block.
- Each part climbs to the biggest box inside the nearest content: the column, an article with its own h1 or h2, a box with three or more paragraphs, headings, lists, quotes, or figures of its own, or a frame whose widgets all sit inside its sections, articles, headers, footers, asides, or navs.
- A box with a widget part or two controls is a widget and stays exactly as it is. A lone control keeps only the box it sits in still, so Learn's "Show all" button doesn't stop the list above it from revealing.
Lists longer than six items reveal item by item. Sections, articles, headers, footers, the column, divs with three or more children, and anything taller than 1.5 windows are opened, up to four levels deep.
kirupaContentReveals.status() reports like the icons: waiting-for-load, waiting, loaded, off, switched off, classic page, page (quizzes, quiz previews, kirupaBot's chat page, html[data-reveal] pages, and the home page), forced colors, reduced motion, or demo. reveal.js also stays off without IntersectionObserver, and for crawlers that name themselves (bot, crawl, spider, slurp, lighthouse, inspectiontool, or preview in the user agent). Turning on reduced motion or high-contrast colors mid-page ends every fade at once and shows everything.
This specimen runs the production reveal.js and reveal.css under the footer's cache key, in a short article that scrolls inside its frame. Choose a mode and scroll with a trackpad, a wheel, or the arrow keys; Replay reveals goes back to the top and holds everything below the frame again. Pause motion, like reduced motion, shows everything:
Content reveals
LOCAL PREVIEWActivate this specimen to load its real styles. No saved preferences change.
One IntersectionObserver watches every block, and each block is unobserved once it shows. Positions are read only when a scroll settles, never while it runs. Only opacity and transform animate, with no will-change, so text never reflows; reveal.css applies nothing until the script marks a block. Both layers load after the page's load event, once the browser is idle or within 2s (400ms where requestIdleCallback is missing). Measured on kirupa.com at 1440x900, medians of 5 runs on the AI agent article, the long JavaScript objects tutorial, and Learn:
| Measure | Before reveals | All sections | Reveals Off |
|---|---|---|---|
| Layout shift (CLS) | 0-0.0006 | 0-0.0006 | 0-0.0006 |
| Long tasks | 0 | 0 | 0 |
| Scroll frames, 95th percentile | 16.7-16.8ms | 16.7-16.8ms | 16.7-16.8ms |
| Slowest of 3 clicks and 3 Page Downs | 32-48ms | 32-40ms | 32-40ms |
| The same, with a 4x slower CPU | 32-40ms | 40-80ms | 40-56ms |
reveal.js script time | None | 6-46ms (6-99ms at 4x) | None |
Background icons were on in every run; motion.js took 9-39ms of script at normal speed and 5-116ms at 4x.
Its interfaces are:
window.kirupaContentReveals(owned bykirupa.js):on,v,options,defaults,settings(),save(changes),load(), andstatus().window.kirupaReveals(fromreveal.js):get()returns the choice, mode, reason, and counts (blocks,kept,animated,instant, andwaiting);debug()andblocks()serve tests.- The
kirupa:contentrevealsevent (detail:{ reveals }) announces a new choice and restartsreveal.jsfrom where the page is. - Markup:
html[data-kreveal]names the running mode. Held blocks have.kreveal-wait, revealing ones.kreveal-gowith--kreveal-delay, and blocks shown at once.kreveal-now. - Storage:
kirupaContentRevealsholds{"reveals": ...}only when it isn't All sections, and?reveals=offor?reveals=figurestries a choice for one view. - Rollback: set
kirupaContentReveals.onto false infooter.shtml, which also hides the choice. Bump itsvafter changingreveal.jsorreveal.css.
Reveals cost reading time, so the previews measured it. A simulated reader went through the long JavaScript tutorial at 1440x900, scrolling a screenful and stopping to read, with each option:
| Reveal | Stops on fading text | Wait to read | Animations a minute |
|---|---|---|---|
| None | 0 of 6 | None | 0 |
| Figures only (0.4s) | 0 of 6 | None | 6 |
| Fade up (12px over 0.45s) | 6 of 6 | 0.22s | 66 |
| Headings first | 6 of 6 | 0.23s | 66 |
| Cascade (60ms apart) | 6 of 6 | 0.31s | 66 |
| The home page's reveal, now All sections | 6 of 6 | 0.44s, up to 0.47s | 66 |
| Scroll-linked | 6 of 6 | Until you scroll again | Not measured |
All sections is the default because the site's owner chose the home page's reveal for every page after comparing these previews; the guarantees above keep its cost to that short wait at each stop. Figures only exists for readers who would rather the words never move, and it delayed no text in any test. Scroll-linked is never used: it can't reveal just once, and whatever sits at the bottom of the window stays half-faded until the next scroll. The scroll motion previews keep every option for comparison.
The research agrees on the limits. NN/g found that scroll-triggered text animations delay readers (2017), that fades longer than 500ms read as too slow, and suggest 100-400ms fades, played once, one element type at a time (2023). The onset of motion captures attention even when it's irrelevant (Abrams and Christ, 2003), and animation beside a task slows information seeking, most when it's bright or resembles the task (Zhang, 2000). That's why the icons stay faint, desaturated, and in the margins, settle when scrolling stops, and why every reveal plays once.
Home page
The live homepage uses the shared layers like any page: its search box and numbered sections carry data-motion-avoid, as tutorial text does, so Background icons stay in the gutters beside them, and Content reveals bring in its sections. The earlier icon-field design, kept on the index_preview*.htm previews, draws its own motion, so both site-wide layers stand down on [data-hp-hero] there, and Customize Theme's hints describe that page instead. Its pieces are:
- Icons: one per AI Fundamentals explainer, swapped to the reader's style by the header. The page shows up to 12 (the first icon of each of its 8 tracks, plus 4 more), and windows narrower than 700px show up to 8, taken round-robin so every track keeps one. They're 38-56px (30-40px narrow), placed in the open space around the words with 22px of clearance. Each wanders 12px and 5 degrees on a 6-13s loop and dances on a 1.2-2.6s beat.
- Hovering an icon shows its title and track and makes it boogie, and a click opens the explainer. The icons are links with
tabindex="-1"in anaria-hiddenlayer, because every explainer is also linked in the page. - Tour: the four "Ever wondered..." questions light up their track's icons in turn, 2.6s after the page opens and then every 5.5s, with a progress bar. Hover or focus holds a question, and leaving resumes 5.5s later. It doesn't advance while the tab is hidden.
- Tour label: on windows wider than 1200px it hangs under or over a lit icon beside the column, 24px from the words and 16px from the window's edge, on a 36px line. Narrower windows put it beside an icon on a 38px line. It's 190-290px wide, needs 170px of room, stays clear of the words and the kirupaBot launcher, and moves back into view 160ms after a scroll settles. With no room, the icons light up alone.
- Its own reveal: sections rise 24px and fade in over 0.7s, 70ms apart for up to 4 that arrive together, once each, when they're 8% of the window above its bottom edge.
- Background icons > Motion: Off hides the icons, the tour label, and the titles. Still holds the icons and stops the tour on the first question's track, as reduced motion does. Every other choice lets them move.
- Content reveals: Off shows every section at once. Figures only shows text and cards at once, lets only the icons rise 8px over 0.4s, and still fills the track meters. All sections keeps the whole-section reveal. Reduced motion shows everything at once in every mode.
Authoring motion
Opt a page, section, or element out with these hooks:
| Hook | Where | Effect |
|---|---|---|
data-live-demo | A lab, game, or runnable example | The page counts as a live demo: no icons and no reveals |
data-reveal-skip | Any element | That element is never held |
data-motion-avoid | Any element | Icons keep 16-20px clear of it |
data-motion | <html> | The page runs its own motion: no icons and no Background icons choice |
data-reveal | <html> | The page runs its own reveal: no reveals and no Content reveals choice |
data-hp-hero | The home page's opening | Both layers stand down |
data-motion-section | <html> | Picks an icon pool: ai, code, quiz, learn, or site |
data-motion-icons | <html> | Lists the icon codes to use, separated by spaces |
A new animation needs a reason: orientation, feedback, or a deliberate moment of delight. Give it one owner, a still state, a reduced-motion path, and a way to turn it off, ideally a Customize Theme choice. Animate opacity and transform, read layout only when a scroll settles, stop work offscreen and in hidden tabs, and never move text someone is reading.
Testing
Test motion the way readers scroll. tools/motion.browser.mjs runs the site-wide layers in WebKit or Chromium (BROWSER=webkit or chromium; point DESIGN_PLAYWRIGHT_PATH at .github/tools/node_modules/playwright/index.mjs). By default it serves this checkout with its includes expanded and no network; set BASE to read a running site instead, which it never posts to. It checks that:
- Articles, tutorials, and Learn reveal under trackpad-style wheel flicks and leave nothing hidden once they stop, while above the fold never dims.
- The End key, keyboard focus, anchors, find in page, and print show content at once, and nothing is hidden without JavaScript or with reduced motion.
- Labs, coding exercises, quizzes, and the home page stand down, the home page runs its own reveal, and widgets with their markers removed are never held.
- Background icons stay out of the text column and rails, follow each Motion choice, turn Still for reduced motion, and leave the page for Off.
- Content arriving mid-scroll snaps no spring back and moves no Still icon on screen, and a resize that moves icons crossfades them.
- Customize Theme stores only choices that differ from the defaults, and Reset clears them.
Scroll with many small mouse.wheel steps that slow down like a trackpad's momentum, in WebKit as well as Chromium. A programmatic scroll is a jump and shows everything at once, so it proves nothing about reveals. Check every style in light and dark, and compare CLS, long tasks, and the slowest click or key with the layer off.
Motion files are cached hard. The origin ignores ?v=, and Cloudflare's edge keeps CSS and JS for about 31 days under each exact URL, so follow these rules:
- Bump the footer's
vformotion.*orreveal.*, and thekirupa.jskey, with every change, and publishfooter.shtmllast. - Upload a file before anything references its new key, and never request a new key before its upload: the edge would keep the old bytes under the new key for a month.
- A rollback needs fresh keys too, because going back to an old key serves whatever the edge holds for it.
design/generated/motion-specimen-config.jscopies the footer's keys and Customize Theme's choices for these specimens, under its own content hash, so rebuild the design system after changing them.
- Do give every animation a reason, a still state, a reduced-motion path, and a way to turn it off.
- Do animate opacity and transform, read layout only when scrolling settles, and stop work offscreen and in hidden tabs.
- Do mark labs, games, and runnable examples with data-live-demo.
- Do test with trackpad-style wheel flicks in WebKit and Chromium, not programmatic scrolls.
- Do keep keyboard focus and hit targets stable through a transition.
- Do not move or hold back text someone is reading, code, tables, embeds, or anything they can interact with.
- Do not move decoration when content arrives; only a resize or a new choice may, and then crossfade.
- Do not start motion while the reader is still, except Drift, which readers choose, and the home page's opening.
- Do not use a spinning or bouncing object to conceal a loading error.
- Do not request a new ?v= key before its file is uploaded.