<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Stitch Draw</title>
<style>
:root{--ground:#F3EEE2;--card2:#EBE8D7;--ink:#1E1F15;--muted:#5A5E3B;--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%;overflow:hidden;background:var(--ground);color:var(--ink);font-family:var(--font);-webkit-font-smoothing:antialiased}
.stage{position:fixed;inset:0;display:grid;place-items:center;cursor:pointer}
.frame{position:relative;width:min(78vw,56vh*1.5);height:min(78vh,52vw/.75)}
.photo{position:absolute;inset:12px;overflow:hidden;background:var(--card2)}
.photo img{width:100%;height:100%;object-fit:cover;display:block}
svg.stitch{position:absolute;inset:2px;width:calc(100% - 4px);height:calc(100% - 4px);overflow:visible;pointer-events:none}
svg.stitch path{fill:none;stroke:var(--ink);stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.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}
@media (prefers-reduced-motion:reduce){.hint{display:none}}
</style>
</head>
<body>
<div class="stage" id="stage" role="button" tabindex="0" aria-label="Play the stitch again">
<div class="frame">
<div class="photo"><img class="cover" id="pic" src="/images/webp/gold-collar.webp" alt=""></div>
<svg class="stitch" viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true">
<defs>
<mask id="draw">
<path id="maskpath" d="M2 2 H98 V98 H2 Z" fill="none" stroke="#fff" stroke-width="3"></path>
</mask>
</defs>
<path id="path" d="M2 2 H98 V98 H2 Z" stroke-dasharray="1.8 2.4" mask="url(#draw)"></path>
</svg>
</div>
</div>
<p class="hint">Click or tap to play again</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 path = document.getElementById("path");
const maskpath = document.getElementById("maskpath");
const pic = document.getElementById("pic");
const len = maskpath.getTotalLength();
maskpath.style.strokeDasharray = String(len);
maskpath.style.strokeDashoffset = String(len);
let tl, busy=false;
function play(){
if (busy) return;
if (reduce){
maskpath.style.strokeDashoffset = "0";
pic.style.clipPath = "inset(0)";
return;
}
busy = true;
if (tl) tl.kill();
gsap.set(maskpath, {strokeDashoffset:len});
gsap.set(pic, {clipPath:"inset(100% 0 0 0)"});
tl = gsap.timeline({onComplete(){ busy=false; }})
.to(maskpath, {strokeDashoffset:0, duration:2.0, ease:"none"}, 0.1)
.to(pic, {clipPath:"inset(0% 0 0 0)", duration:1.3, ease:"power3.inOut"}, 0.55);
}
play();
const stage = document.getElementById("stage");
stage.addEventListener("click", play);
stage.addEventListener("keydown", (e)=>{ if(e.key==="Enter"||e.key===" ") { e.preventDefault(); play(); }});
})();
</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 “Stitch Draw”.
A running stitch draws the frame, and the still is revealed with it.
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.