Skip to content

Commit d7976f3

Browse files
committed
Enable landing page animation on touch devices
1 parent 91c6d62 commit d7976f3

3 files changed

Lines changed: 5 additions & 19 deletions

File tree

‎DESIGN.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ mobile text region begins.
5959

6060
Only the homepage particle field moves. Its transformations explain the current
6161
chapter. Reduced-motion preferences place the particles directly into each
62-
formation. Coarse-pointer screens up to 820px use the same static formations to
63-
reduce battery use during the mobile reading journey. Interior pages do not use
64-
decorative animation.
62+
formation. The particle field otherwise animates on both pointer and touch
63+
screens. Interior pages do not use decorative animation.
6564

6665
## Language
6766

‎public/mdbase-murmuration.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
const canvas = document.querySelector("#diagram");
44
const context = canvas.getContext("2d", { alpha: true });
55
const chapters = [...document.querySelectorAll(".chapter")];
6-
const reduceMotion =
7-
matchMedia("(prefers-reduced-motion: reduce)").matches
8-
|| matchMedia("(max-width: 820px) and (pointer: coarse)").matches;
6+
const reduceMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
97
const particleCount = 361;
108
const cellSize = 104;
119
const particles = [];

‎scripts/sync-sources.mjs‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -402,22 +402,11 @@ function addThemeAwareCanvasPalette(source) {
402402
403403
function draw(now)`
404404
);
405-
const motionPreference =
406-
' const reduceMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;';
407-
if (!withParticles.includes(motionPreference)) {
408-
throw new Error("Could not find the prototype motion preference");
409-
}
410-
const withMobileMotion = withParticles.replace(
411-
motionPreference,
412-
` const reduceMotion =
413-
matchMedia("(prefers-reduced-motion: reduce)").matches
414-
|| matchMedia("(max-width: 820px) and (pointer: coarse)").matches;`
415-
);
416405
const initialization = " resize();\n updateScrollState();";
417-
if (!withMobileMotion.includes(initialization)) {
406+
if (!withParticles.includes(initialization)) {
418407
throw new Error("Could not find the prototype initialization");
419408
}
420-
const withInitialization = withMobileMotion.replace(
409+
const withInitialization = withParticles.replace(
421410
initialization,
422411
" syncPalette();\n resize();\n updateScrollState();"
423412
);

0 commit comments

Comments
 (0)