<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Look Rail</title>
<style>
:root{
--ground:#F3EEE2;--card:#E6E3CE;--card2:#EBE8D7;--ink:#1E1F15;--deep:#0F100A;
--lift:#3D4128;--muted:#5A5E3B;--soft:#C9C8A6;--accent:#86914C;
--font:"Geist",system-ui,-apple-system,sans-serif;
}
@font-face{font-family:"Geist";src:url("/fonts-geist/Geist-Regular-latin.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap;}
@font-face{font-family:"Geist";src:url("/fonts-geist/Geist-Medium-latin.woff2") format("woff2");font-weight:500;font-style:normal;font-display:swap;}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--ground);color:var(--ink);font-family:var(--font);-webkit-font-smoothing:antialiased}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}
.cover{width:100%;height:100%;object-fit:cover;object-position:center;display:block;pointer-events:none;user-select:none}
.hint{position:fixed;left:50%;bottom:5vh;transform:translateX(-50%);margin:0;font-size:10px;font-weight:500;letter-spacing:.22em;text-transform:uppercase;color:var(--muted);pointer-events:none;z-index:5;white-space:nowrap}
@media (prefers-reduced-motion:reduce){ .hint{display:none} }
html,body{overflow:hidden}
.stage{position:fixed;inset:0;overflow:hidden;touch-action:pan-y;cursor:grab}
.stage.is-drag{cursor:grabbing}
.rail{position:absolute;top:50%;left:0;display:flex;gap:2.2vw;align-items:center;height:72vh;transform:translateY(-50%);will-change:transform}
.cell{flex:0 0 auto;width:min(42vh,38vw);height:100%;overflow:hidden;background:var(--card2);border-radius:4px}
.cell img{width:100%;height:100%;object-fit:cover;display:block}
</style>
</head>
<body>
<div class="stage" id="stage">
<div class="rail" id="rail"></div>
</div>
<p class="hint">Drag or wheel</p>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.13.0/dist/gsap.min.js"></script>
<script>
(function(){
const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const srcOf = (f) => "/images/webp/" + f;
const files = ["look-hero.webp","golden-hour-coat.webp","platform-suit.webp","courtyard-coat.webp","wet-street-coat.webp","coastal-white.webp","look-walk.webp","autumn-clearing.webp"];
const rail = document.getElementById("rail");
const stage = document.getElementById("stage");
// Triple the set so the loop can wrap cleanly.
const set = files.concat(files, files);
set.forEach((f, n) => {
const cell = document.createElement("div");
cell.className = "cell";
const img = document.createElement("img");
img.className = "cover";
img.alt = "";
img.src = srcOf(f);
cell.appendChild(img);
rail.appendChild(cell);
});
const cells = [...rail.children];
let unit = 0;
function measure(){
const c = cells[0];
const gap = parseFloat(getComputedStyle(rail).gap) || 0;
unit = c.getBoundingClientRect().width + gap;
}
measure();
const setWidth = () => unit * files.length;
let x = -setWidth() + (stage.clientWidth / 2 - unit / 2);
let vx = 0;
let dragging = false, lastPx = 0, lastT = 0;
const center = () => stage.clientWidth / 2;
function render(){
// wrap
const sw = setWidth();
if (x > -sw * 0.5) x -= sw;
if (x < -sw * 1.5) x += sw;
rail.style.transform = `translate3d(${x}px,-50%,0)`;
const mid = center();
cells.forEach((cell) => {
const r = cell.getBoundingClientRect();
const cx = r.left + r.width/2;
const d = Math.abs(cx - mid);
const t = Math.min(1, d / (r.width * 1.6));
const s = 1 - t * 0.12;
const o = 1 - t * 0.35;
cell.style.transform = `scale(${s})`;
cell.style.opacity = String(o);
});
}
function tick(){
if (!dragging && !reduce){
x += vx;
vx *= 0.94;
if (Math.abs(vx) < 0.05) vx = 0;
}
render();
requestAnimationFrame(tick);
}
if (reduce){ render(); }
else requestAnimationFrame(tick);
stage.addEventListener("pointerdown", (e) => {
dragging = true; stage.classList.add("is-drag");
lastPx = e.clientX; lastT = performance.now(); vx = 0;
stage.setPointerCapture(e.pointerId);
});
stage.addEventListener("pointermove", (e) => {
if (!dragging) return;
const dx = e.clientX - lastPx;
x += dx;
const now = performance.now();
const dt = Math.max(1, now - lastT);
vx = dx / dt * 16;
lastPx = e.clientX; lastT = now;
});
const end = () => { dragging=false; stage.classList.remove("is-drag"); };
stage.addEventListener("pointerup", end);
stage.addEventListener("pointercancel", end);
stage.addEventListener("wheel", (e) => {
e.preventDefault();
vx += (Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY) * 0.12;
}, {passive:false});
window.addEventListener("resize", () => { measure(); });
})();
</script>
</body>
</html>
Build a single self-contained HTML file (vanilla CSS and JavaScript; GSAP 3.13+ from jsDelivr, plus ScrollTrigger or Flip only if required) for “Look Rail”.
An infinite rail of stills. The one in the middle comes forward; drag or wheel.
Use the Olive & Moss palette: ground #F3EEE2, card #E6E3CE, ink #1E1F15, deep #0F100A, lift #3D4128, muted #5A5E3B, soft #C9C8A6, accent #86914C. Amber #FFA51F is not used as type. Images use object-fit: cover (or equivalent cover mapping in a shader) and must be undistorted at rest. Easing: expo.out / power3.inOut, no bounce or elastic. Respect prefers-reduced-motion. One file.