176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.
HTML ai-promptsanimationcss-animationsfrontendgithub-pagesjavascriptmicrointeractionsmotion-designno-dependenciesreferencescroll-animationui-animationweb-animationweb-developmentwebgl
feat: scroll pages note under reduced motion that the effects follow the scroll without animating
matina4a8f246776c
diff --git a/assets/js/demo-page.js b/assets/js/demo-page.jsindex a8623713..651db7f7 100644--- a/assets/js/demo-page.js+++ b/assets/js/demo-page.js@@ -110,11 +110,12 @@return s ? '"' + s + '"' : '';}- // The reduced-motion note for the player bar, from what the bar holds ({ loop, slow, pause } as booleans);- // '' when reduced motion changes nothing there.+ // The reduced-motion note for the player bar, from what the bar holds ({ loop, slow, pause } as booleans) and whether the+ // page is a scroll page ({ scroll }); '' when reduced motion changes nothing there.function motionNote(has) {var off = [has.loop && 'Loop', has.slow && 'Slow motion'].filter(Boolean);var parts = [];+ if (has.scroll) parts.push('The effects follow the scroll without animating');if (has.pause) parts.push('It starts paused');if (off.length) parts.push(off.join(' and ') + (off.length > 1 ? ' are' : ' is') + ' off');return parts.length ? parts.join(' and ') + ' because your device is set to reduce motion.' : '';@@ -425,7 +426,8 @@}// While the device asks for reduced motion, Loop and Slow motion are switched off and cannot be switched on, a- // loop starts paused, and a note in the player bar says why. Replay and Play still work.+ // loop starts paused, and a note in the player bar says why. Replay and Play still work. A scroll page has nothing to+ // switch off, and its note says that the effects follow the scroll without animating.var playerSwitches = [loopCtl, slowCtl].filter(Boolean);var noteEl = null;function followReducedMotion() {@@ -437,7 +439,7 @@if (label) label.classList.toggle('is-disabled', reduced);});if (reduced && pauseCtl && !paused) setPaused(true);- var note = reduced ? motionNote({ loop: !!loopCtl, slow: !!slowCtl, pause: !!pauseCtl }) : '';+ var note = reduced ? motionNote({ loop: !!loopCtl, slow: !!slowCtl, pause: !!pauseCtl, scroll: doc.body.getAttribute('data-hb-kind') === 'scroll' }) : '';if (note && !noteEl && player) {noteEl = doc.createElement('p');noteEl.className = 'hb-player-note';diff --git a/tests/demo-page.test.js b/tests/demo-page.test.jsindex f9ac0fd6..6f8d9207 100644--- a/tests/demo-page.test.js+++ b/tests/demo-page.test.js@@ -98,6 +98,7 @@ test('motionNote says what reduced motion changes in the player bar', () => {assert.equal(DP.motionNote({ slow: true }), 'Slow motion is off because your device is set to reduce motion.');assert.equal(DP.motionNote({ pause: true, slow: true }), 'It starts paused and Slow motion is off because your device is set to reduce motion.');assert.equal(DP.motionNote({ pause: true }), 'It starts paused because your device is set to reduce motion.');+ assert.equal(DP.motionNote({ scroll: true }), 'The effects follow the scroll without animating because your device is set to reduce motion.');assert.equal(DP.motionNote({}), '');});@@ -174,3 +175,14 @@ test('a do-it page presses nothing on arrival under reduced motion', () => {page.runTimers();assert.equal(page.demo.clicks, 0);});++test('a scroll page says under reduced motion that the effects follow the scroll without animating', () => {+ const page = standInPage('scroll', true);+ assert.deepEqual(page.player.children.map(c => [c.className, c.textContent]),+ [['hb-player-note', 'The effects follow the scroll without animating because your device is set to reduce motion.']]);+});++test('reduced motion adds no note to a scroll page that is not set to reduce motion, or to a do-it page with nothing to switch off', () => {+ assert.equal(standInPage('scroll', false).player.children.length, 0);+ assert.equal(standInPage('do', true).player.children.length, 0);+});