<section class="demo" id="stage">
<figure class="demo__preview" id="preview" aria-hidden="true"></figure>
<ul class="demo__list">
<li data-tone="a"><span>North Archive</span><em>Vol. 04</em></li>
<li data-tone="b"><span>Quiet Signal</span><em>Vol. 11</em></li>
<li data-tone="c"><span>Field Notes</span><em>Vol. 18</em></li>
<li data-tone="d"><span>Night Studio</span><em>Vol. 22</em></li>
</ul>
</section>.demo {
position: relative;
min-height: 100dvh;
display: grid;
place-items: center;
padding: 28px 20px;
background: #08080a;
color: #f4f4f2;
font-family: "Helvetica Neue", system-ui, sans-serif;
overflow: hidden;
}
.demo__list {
list-style: none;
margin: 0;
padding: 0;
width: min(520px, 100%);
}
.demo__list li {
display: flex;
align-items: baseline;
justify-content: space-between;
padding: 20px 0;
border-bottom: 1px solid #16161c;
font-size: clamp(22px, 5vw, 34px);
letter-spacing: -0.03em;
color: #6a6a72;
cursor: pointer;
}
.demo__list li:first-child { border-top: 1px solid #16161c; }
.demo__list li.is-on { color: #f4f4f2; }
.demo__list em {
font-style: normal;
font-size: 11px;
letter-spacing: 0.16em;
color: #3f3f46;
}
.demo__preview {
position: fixed;
top: 0;
left: 0;
width: 168px;
height: 210px;
margin: -105px 0 0 -84px;
border-radius: 14px;
pointer-events: none;
opacity: 0.35;
background: linear-gradient(150deg, #2b2f4a, #14161f);
will-change: transform, opacity;
}
@media (prefers-reduced-motion: reduce) {
.demo__preview { display: none; }
}const stage = document.querySelector("#stage");
const preview = document.querySelector("#preview");
const rows = gsap.utils.toArray(".demo__list li");
const tones = {
a: "linear-gradient(150deg, #6f7bd8, #1c2038)",
b: "linear-gradient(150deg, #9fa3ab, #1b1d21)",
c: "linear-gradient(150deg, #4f9bd8, #0e1a25)",
d: "linear-gradient(150deg, #d8b26f, #221c12)",
};
const xTo = gsap.quickTo(preview, "x", { duration: 0.7, ease: "power3" });
const yTo = gsap.quickTo(preview, "y", { duration: 0.7, ease: "power3" });
gsap.set(preview, { x: window.innerWidth * 0.62, y: window.innerHeight * 0.42 });
preview.style.backgroundImage = tones.a;
rows[0].classList.add("is-on");
stage.addEventListener("pointermove", function (event) {
xTo(event.clientX);
yTo(event.clientY);
});
rows.forEach(function (row) {
row.addEventListener("pointerenter", function () {
rows.forEach(function (item) { item.classList.remove("is-on"); });
row.classList.add("is-on");
preview.style.backgroundImage = tones[row.dataset.tone];
gsap.to(preview, { opacity: 1, scale: 1, duration: 0.4, ease: "expo.out" });
});
});
stage.addEventListener("pointerleave", function () {
gsap.to(preview, { opacity: 0.35, scale: 0.92, duration: 0.4, ease: "power2.out" });
});