Let path nodes dim as the spine retreats
Node state now mirrors the fill in both directions with a small deadband, so scrolling back up visibly unlights the stages instead of leaving them stuck on.
This commit is contained in:
1 parent
23a55ea711
commit
a4e9bbc1ea
2 files changed
+14
-10
No files matched your search
@@ -33,8 +33,9 @@ Date: 2026-11-01
|
|||||||
- `src/scripts/site.js`
|
- `src/scripts/site.js`
|
||||||
- The spine handler computes the fill tip against the spine's real top (10px)
|
- The spine handler computes the fill tip against the spine's real top (10px)
|
||||||
and height (wrap height − 20px), then compares each node's centre against
|
and height (wrap height − 20px), then compares each node's centre against
|
||||||
it. A node gets `.lit` when the fill reaches it and stays lit (completed
|
it. Nodes mirror the fill in both directions: they light when it reaches
|
||||||
milestones, no flicker on small scroll jitter).
|
them and dim when it retreats above them, with a 6px deadband so small
|
||||||
|
scroll jitter cannot flicker the state.
|
||||||
- The same scroll-linked logic runs under reduced motion, so nodes still
|
- The same scroll-linked logic runs under reduced motion, so nodes still
|
||||||
respond; only the CSS animation/transitions are stopped. The previous
|
respond; only the CSS animation/transitions are stopped. The previous
|
||||||
reduce branch force-lit every node and filled the spine to 100%, which made
|
reduce branch force-lit every node and filled the spine to 100%, which made
|
||||||
@@ -58,7 +59,8 @@ Date: 2026-11-01
|
|||||||
- Peacock `animation-name: peacock-bob`, duration 6s, `--bob: 6px`; sampled
|
- Peacock `animation-name: peacock-bob`, duration 6s, `--bob: 6px`; sampled
|
||||||
range 4.88px over a partial cycle (the full cycle is 6px).
|
range 4.88px over a partial cycle (the full cycle is 6px).
|
||||||
- Scrolling the path lit nodes in order (`0000 → 1000 → 1100 → 1110 → 1111`)
|
- Scrolling the path lit nodes in order (`0000 → 1000 → 1100 → 1110 → 1111`)
|
||||||
while the spine fill advanced 0→100%, in both normal and reduced-motion mode.
|
while the spine fill advanced 0→100%, and scrolling back up dimmed them in
|
||||||
|
reverse. Verified in both normal and reduced-motion mode.
|
||||||
- Reduced motion: peacock/aura animations `none` and the fill starts at 0%; nodes
|
- Reduced motion: peacock/aura animations `none` and the fill starts at 0%; nodes
|
||||||
stay unlit until scrolling reaches them. This is what the user saw as
|
stay unlit until scrolling reaches them. This is what the user saw as
|
||||||
"peacock stays still / nodes lit by default".
|
"peacock stays still / nodes lit by default".
|
||||||
@@ -69,8 +71,8 @@ Date: 2026-11-01
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- Nodes intentionally stay lit after the fill passes them; scrolling up shrinks
|
- Nodes track the line both ways, so the path reads as a live progress trail
|
||||||
the line but does not erase completed stages.
|
rather than a one-way checklist.
|
||||||
- The peacock/aura motion is intentionally off when the visitor (or the
|
- The peacock/aura motion is intentionally off when the visitor (or the
|
||||||
developer's machine) has `prefers-reduced-motion: reduce`. If the bob looks
|
developer's machine) has `prefers-reduced-motion: reduce`. If the bob looks
|
||||||
frozen, check that setting first.
|
frozen, check that setting first.
|
||||||
|
|||||||
+7
-5
@@ -15,9 +15,10 @@
|
|||||||
els.forEach(function (e) { io.observe(e); });
|
els.forEach(function (e) { io.observe(e); });
|
||||||
}
|
}
|
||||||
|
|
||||||
// The spine "draws" as you scroll. A stage's node lights up the moment the
|
// The spine "draws" as you scroll. Nodes mirror the fill: a node lights when
|
||||||
// fill reaches it, so the line and the milestones move together. Nodes stay
|
// the fill reaches it and dims again if you scroll back above it, so the two
|
||||||
// lit once reached: they mark completed stages, not current scroll position.
|
// always tell the same story. A 6px deadband keeps tiny scroll jitter from
|
||||||
|
// flickering the state.
|
||||||
var fill = document.getElementById("spineFill"),
|
var fill = document.getElementById("spineFill"),
|
||||||
sw = document.querySelector(".spine-wrap"),
|
sw = document.querySelector(".spine-wrap"),
|
||||||
stages = sw ? [].slice.call(sw.querySelectorAll(".stage")) : [],
|
stages = sw ? [].slice.call(sw.querySelectorAll(".stage")) : [],
|
||||||
@@ -37,9 +38,10 @@
|
|||||||
|
|
||||||
var fillY = spineTop + p * spineH;
|
var fillY = spineTop + p * spineH;
|
||||||
stages.forEach(function (stage) {
|
stages.forEach(function (stage) {
|
||||||
if (stage.classList.contains("lit")) return;
|
|
||||||
var nodeY = stage.getBoundingClientRect().top - r.top + 18; // node top (7) + radius (11)
|
var nodeY = stage.getBoundingClientRect().top - r.top + 18; // node top (7) + radius (11)
|
||||||
if (fillY >= nodeY) stage.classList.add("lit");
|
var on = stage.classList.contains("lit");
|
||||||
|
var next = on ? fillY >= nodeY - 6 : fillY >= nodeY;
|
||||||
|
if (next !== on) stage.classList.toggle("lit", next);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user