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:
yigid authored and Yigid BALABAN committed 2026-11-01 13:42:57 +03:00
1 parent 23a55ea711
commit a4e9bbc1ea
2 files changed
+14 -10

No files matched your search

+7 -5
View File
@@ -33,8 +33,9 @@ Date: 2026-11-01
- `src/scripts/site.js`
- 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
it. A node gets `.lit` when the fill reaches it and stays lit (completed
milestones, no flicker on small scroll jitter).
it. Nodes mirror the fill in both directions: they light when it reaches
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
respond; only the CSS animation/transitions are stopped. The previous
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
range 4.88px over a partial cycle (the full cycle is 6px).
- 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
stay unlit until scrolling reaches them. This is what the user saw as
"peacock stays still / nodes lit by default".
@@ -69,8 +71,8 @@ Date: 2026-11-01
## Notes
- Nodes intentionally stay lit after the fill passes them; scrolling up shrinks
the line but does not erase completed stages.
- Nodes track the line both ways, so the path reads as a live progress trail
rather than a one-way checklist.
- The peacock/aura motion is intentionally off when the visitor (or the
developer's machine) has `prefers-reduced-motion: reduce`. If the bob looks
frozen, check that setting first.
+7 -5
View File
@@ -15,9 +15,10 @@
els.forEach(function (e) { io.observe(e); });
}
// The spine "draws" as you scroll. A stage's node lights up the moment the
// fill reaches it, so the line and the milestones move together. Nodes stay
// lit once reached: they mark completed stages, not current scroll position.
// The spine "draws" as you scroll. Nodes mirror the fill: a node lights when
// the fill reaches it and dims again if you scroll back above it, so the two
// always tell the same story. A 6px deadband keeps tiny scroll jitter from
// flickering the state.
var fill = document.getElementById("spineFill"),
sw = document.querySelector(".spine-wrap"),
stages = sw ? [].slice.call(sw.querySelectorAll(".stage")) : [],
@@ -37,9 +38,10 @@
var fillY = spineTop + p * spineH;
stages.forEach(function (stage) {
if (stage.classList.contains("lit")) return;
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);
});
}