Animate the backdrop, path nodes, and hero mark

Three aura layers now drift on independent clocks; path nodes light as the spine fill reaches them; the hero peacock bobs 5px with tunable --bob / --bob-speed. Also gradient the Project half of the footer wordmark. All motion is disabled under prefers-reduced-motion.
This commit is contained in:
yigid authored and Yigid BALABAN committed 2026-11-01 13:35:24 +03:00
1 parent 739f2ad395
commit fb7cf66a30
3 files changed
+83 -19

No files matched your search

+25 -7
View File
@@ -15,20 +15,38 @@
els.forEach(function (e) { io.observe(e); });
}
// the spine "draws" as you scroll through the path
// 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.
var fill = document.getElementById("spineFill"),
sw = document.querySelector(".spine-wrap"),
stages = sw ? [].slice.call(sw.querySelectorAll(".stage")) : [],
tick = false;
function spine() {
tick = false;
if (!fill || !sw) return;
var r = sw.getBoundingClientRect();
var p = (innerHeight * 0.5 - r.top) / r.height;
fill.style.height = (Math.max(0, Math.min(1, p)) * 100) + "%";
if (!sw) return;
var r = sw.getBoundingClientRect(),
h = r.height,
spineTop = 10,
spineH = Math.max(1, h - 20),
p = (innerHeight * 0.5 - r.top - spineTop) / spineH;
p = Math.max(0, Math.min(1, p));
if (fill) fill.style.height = (p * 100) + "%";
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");
});
}
if (fill && sw) {
if (sw) {
if (reduce) {
fill.style.height = "100%";
if (fill) fill.style.height = "100%";
stages.forEach(function (stage) { stage.classList.add("lit"); });
} else {
var onsc = function () { if (!tick) { tick = true; requestAnimationFrame(spine); } };
addEventListener("scroll", onsc, { passive: true });