176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.
HTML ai-promptsanimationcss-animationsfrontendgithub-pagesjavascriptmicrointeractionsmotion-designno-dependenciesreferencescroll-animationui-animationweb-animationweb-developmentwebgl
feat: the headset version follows the real motion: the stack rises, its parts leave through the top and the body turns to face you
matinbb8cb751c320
diff --git a/famous/index.html b/famous/index.htmlindex 0b253d03..faa478e2 100644--- a/famous/index.html+++ b/famous/index.html@@ -229,17 +229,18 @@ button{font:inherit;color:inherit}.gp-ribbon .rs4{top:62cqh;transform:rotate(4deg);background:linear-gradient(90deg,transparent,#fff 35%,var(--c5) 75%,transparent)}.gp-ribbon .rs5{top:70cqh;transform:rotate(8deg);background:linear-gradient(90deg,transparent,#fff 35%,var(--c3) 75%,transparent)}-/* the headset: the finished visor drawn as four plates (glass, frame ring, lenses, coral band ring). At rest they are taken apart and- seen at a tilt, glass on top; the loop puts them together, tips the visor up to show the lens rings and comes round again. */+/* the headset: the visor drawn as four plates (glass, frame ring, lenses, coral band ring). At rest they are taken apart and seen at+ a tilt, glass on top; the loop brings the stack up from below, carries the glass and the frame off the top while the lenses and the+ band turn to face you, then fades and starts again. */.gp-visor{background:radial-gradient(70% 90% at 50% 55%,#111631,#08080a 72%);perspective:90cqw}.vz{--u:4.2cqw;position:absolute;left:calc(50cqw - var(--u) * 5);top:calc(35cqw - var(--u) * 2.275);width:calc(var(--u) * 10);height:calc(var(--u) * 4.55);transform-style:preserve-3d;transform:rotateX(64deg) rotateY(-16deg)}.vz>i{transform:translateZ(calc(var(--u) * var(--z1)))}-.v-glass{inset:0;border-radius:34% / 50%;overflow:hidden;--z0:.12;--z1:4.5;background:linear-gradient(180deg,rgba(255,255,255,.22),transparent 48%),linear-gradient(135deg,rgba(110,168,255,.66),rgba(63,214,196,.5));box-shadow:inset 0 0 0 calc(var(--u) * .07) rgba(255,255,255,.6),inset 0 calc(var(--u) * -.6) calc(var(--u) * 1.2) rgba(63,214,196,.3)}+.v-glass{inset:0;border-radius:34% / 50%;overflow:hidden;--z0:.12;--z1:4.5;--z2:22;background:linear-gradient(180deg,rgba(255,255,255,.22),transparent 48%),linear-gradient(135deg,rgba(110,168,255,.66),rgba(63,214,196,.5));box-shadow:inset 0 0 0 calc(var(--u) * .07) rgba(255,255,255,.6),inset 0 calc(var(--u) * -.6) calc(var(--u) * 1.2) rgba(63,214,196,.3)}.v-glass::before,.v-glass::after{content:"";position:absolute;top:-12%;bottom:-12%;transform:skewX(-24deg);background:linear-gradient(90deg,transparent,rgba(255,255,255,.55),transparent)}.v-glass::before{left:15%;width:13%}.v-glass::after{left:33%;width:3.5%}.v-frame,.v-band{border:solid transparent;-webkit-mask:linear-gradient(#000 0 0) padding-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask:linear-gradient(#000 0 0) padding-box,linear-gradient(#000 0 0);mask-composite:exclude}-.v-frame{inset:calc(var(--u) * -.28);border-width:calc(var(--u) * .5);border-radius:34% / 50%;--z0:.08;--z1:1.5;background:linear-gradient(135deg,#e2d2ff,var(--c3) 45%,#7d57dd) border-box}+.v-frame{inset:calc(var(--u) * -.28);border-width:calc(var(--u) * .5);border-radius:34% / 50%;--z0:.08;--z1:1.5;--z2:17;background:linear-gradient(135deg,#e2d2ff,var(--c3) 45%,#7d57dd) border-box}.v-band{inset:calc(var(--u) * -.28) calc(var(--u) * -1.15);border-width:calc(var(--u) * .4);border-radius:99em;--z0:0;--z1:-4.5;background:linear-gradient(90deg,var(--c5),var(--c4) 50%,var(--c5)) border-box}.v-lens{inset:0;transform-style:preserve-3d;--z0:.04;--z1:-1.5}.v-lens span{position:absolute;inset:0;backface-visibility:hidden}@@ -378,8 +379,9 @@ button{font:inherit;color:inherit}@keyframes g-rib{from{transform:rotate(-16deg) translateY(-30%) scaleY(.5)}to{transform:rotate(10deg) translateY(30%) scaleY(1.3)}}@keyframes g-rs{from{transform:rotate(-14deg) translateY(-12cqh) scaleX(.92)}to{transform:rotate(11deg) translateY(12cqh) scaleX(1.06)}}-@keyframes g-lift{0%,6%{transform:translateZ(calc(var(--u) * var(--z0)))}24%,52%{transform:translateZ(calc(var(--u) * var(--z1)))}70%,100%{transform:translateZ(calc(var(--u) * var(--z0)))}}-@keyframes g-tip{0%,6%{transform:rotateX(8deg) rotateY(12deg)}26%,52%{transform:rotateX(64deg) rotateY(-16deg)}70%,76%{transform:rotateX(8deg) rotateY(12deg)}88%,95%{transform:rotateX(188deg) rotateY(12deg)}100%{transform:rotateX(368deg) rotateY(12deg)}}+@keyframes g-lift{0%,26%{transform:translateZ(calc(var(--u) * var(--z1)))}44%{transform:translateZ(calc(var(--u) * var(--z1)))}70%,100%{transform:translateZ(calc(var(--u) * var(--z0)))}}+@keyframes g-away{0%,24%{opacity:1;transform:translateZ(calc(var(--u) * var(--z1)))}44%{opacity:1;transform:translateZ(calc(var(--u) * var(--z2)))}46%,100%{opacity:0;transform:translateZ(calc(var(--u) * var(--z2)))}}+@keyframes g-tip{0%,4%{transform:translateY(62cqh) rotateX(64deg) rotateY(-16deg)}28%,44%{transform:translateY(0) rotateX(64deg) rotateY(-16deg)}70%,84%{transform:translateY(0) rotateX(188deg) rotateY(12deg)}98%,100%{transform:translateY(-72cqh) rotateX(188deg) rotateY(12deg)}}@keyframes g-blob{0%,100%{transform:translate(14cqw,14cqh)}25%{transform:translate(48cqw,8cqh)}50%{transform:translate(52cqw,30cqh)}75%{transform:translate(22cqw,32cqh)}}@keyframes g-blob-i{0%,100%{transform:translate(-14cqw,-14cqh)}25%{transform:translate(-48cqw,-8cqh)}50%{transform:translate(-52cqw,-30cqh)}75%{transform:translate(-22cqw,-32cqh)}}@keyframes g-line{0%,6%{opacity:0;transform:translateY(5cqh)}24%,80%{opacity:1;transform:none}92%,100%{opacity:0;transform:translateY(-2cqh)}}@@ -410,12 +412,12 @@ button{font:inherit;color:inherit}.gp-ribbon .rs3{animation-duration:13s;animation-delay:-7s}.gp-ribbon .rs4{animation-duration:10s;animation-delay:-2s}.gp-ribbon .rs5{animation-duration:12s;animation-delay:-5s}- .gp-visor{--x:3.4s}+ .gp-visor{--x:2.4s}.gp-visor .vz{animation:g-tip 9s ease-in-out infinite backwards;animation-delay:calc(0s - var(--x))}.gp-visor .vz>i{animation:g-lift 9s ease-in-out infinite backwards;animation-delay:calc(var(--d,0s) - var(--x))}- .gp-visor .vz>.v-frame{--d:.14s}- .gp-visor .vz>.v-lens{--d:.28s}- .gp-visor .vz>.v-band{--d:.42s}+ .gp-visor .vz>.v-glass,.gp-visor .vz>.v-frame{animation-name:g-away}+ .gp-visor .vz>.v-frame{--d:.22s}+ .gp-visor .vz>.v-band{--d:.14s}.rv-blob{animation:g-blob 9s ease-in-out infinite backwards}.rv-b{animation:g-blob-i 9s ease-in-out infinite backwards}.gp-intro{--x:2.6s}diff --git a/famous/versions/apple-scroll.html b/famous/versions/apple-scroll.htmlindex 43357a02..28f79460 100644--- a/famous/versions/apple-scroll.html+++ b/famous/versions/apple-scroll.html@@ -14,16 +14,24 @@ html.lite{--g1:0 0 #0000;--g2:0 0 #0000}*{box-sizing:border-box;margin:0}html{background:#0b0b0f;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#3c3c4a #0b0b0f}body{color:#f4f4f2;font:400 15px/1.5 'Schibsted Grotesk',system-ui,-apple-system,'Segoe UI',sans-serif;-webkit-font-smoothing:antialiased}-.track{--B:calc(var(--H) * .34);--rest:calc(var(--H) - 57px);--top:32px;--f:.43 .57 .43 .57 .6;--sh:calc(var(--H) - 145px);--gx:50%;--gy:calc(var(--top) + var(--sh) / 2);display:grid;height:calc(var(--H) + 5.3 * var(--B));overflow:clip}-.stage{grid-area:1/1;align-self:start;position:sticky;top:0;height:var(--H);overflow:hidden;background:radial-gradient(circle 80vmin at var(--gx) var(--gy),rgba(110,168,255,.2),rgba(185,140,255,.08) 55%,transparent),#0b0b0f}-.scene{--w:min(68vw,calc(var(--sh) * 1.22),520px);position:absolute;left:0;top:var(--top);width:100%;height:var(--sh);display:grid;place-items:center;font-size:calc(var(--w) / 10);perspective:32em}-.obj{position:relative;width:10em;height:4.55em;transform-style:preserve-3d;transform:rotateY(12deg) rotateX(8deg)}+.track{--w:min(62vw,calc(var(--H) * .62),480px);position:relative;height:calc(var(--H) * 3.3);overflow:clip}+.stage{position:sticky;top:0;height:var(--H);overflow:hidden;background:radial-gradient(circle 80vmin at 50% 44%,rgba(110,168,255,.2),rgba(185,140,255,.08) 55%,transparent),#0b0b0f}+.scene{--sh:var(--H);position:absolute;inset:0;font-size:calc(var(--w) / 10)}+.pw{position:absolute;left:50%;top:50%;width:0;height:0;perspective:32em}+.obj{position:absolute;left:-5em;top:-2.275em;width:10em;height:4.55em;transform-style:preserve-3d}+.pp{transform:translateY(calc(var(--sh) * .5))}+.parts{transform:rotateY(-16deg) rotateX(66deg)}+.pb{transform:translateY(calc(var(--sh) * 1.059))}+.body{transform:rotateY(-10deg) rotateX(100deg)}.l{position:absolute;inset:0}-.glass,.frame{border-radius:34% / 50%}-.glass{--s2:linear-gradient(114deg,transparent 36%,rgba(255,255,255,.55) 37.3%,transparent 38.7%);transform:translateZ(.12em);background:var(--s2),linear-gradient(114deg,transparent 21%,rgba(255,255,255,.55) 26.3%,transparent 31.7%),linear-gradient(180deg,rgba(255,255,255,.22),transparent 48%),linear-gradient(135deg,rgba(110,168,255,.66),rgba(63,214,196,.5));box-shadow:inset 0 0 0 .07em rgba(255,255,255,.6),inset 0 -.6em 1.2em rgba(63,214,196,.3),var(--g1)}+.glass,.frame,.pl1,.back{border-radius:34% / 50%}+.glass{--s2:linear-gradient(114deg,transparent 36%,rgba(255,255,255,.55) 37.3%,transparent 38.7%);transform:translateZ(1.19em);background:var(--s2),linear-gradient(114deg,transparent 21%,rgba(255,255,255,.55) 26.3%,transparent 31.7%),linear-gradient(180deg,rgba(255,255,255,.22),transparent 48%),linear-gradient(135deg,rgba(110,168,255,.66),rgba(63,214,196,.5));box-shadow:inset 0 0 0 .07em rgba(255,255,255,.6),inset 0 -.6em 1.2em rgba(63,214,196,.3),var(--g1)}.frame,.band{border:solid transparent;-webkit-mask:linear-gradient(#000 0 0) padding-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask:linear-gradient(#000 0 0) padding-box,linear-gradient(#000 0 0);mask-composite:exclude}-.frame{inset:-.28em;border-width:.5em;transform:translateZ(.08em);background:linear-gradient(135deg,#e2d2ff,#b98cff 45%,#7d57dd) border-box}-.lens{transform:translateZ(.04em);transform-style:preserve-3d}+.frame{inset:-.28em;border-width:.5em;transform:translateZ(.385em);background:linear-gradient(135deg,#e2d2ff,#b98cff 45%,#7d57dd) border-box}+.pl1{inset:.2em;transform:translateZ(-.385em);background:linear-gradient(135deg,rgba(185,140,255,.5),rgba(110,168,255,.26));box-shadow:inset 0 0 0 .07em rgba(255,255,255,.5)}+.pl2{inset:-.1em .5em;border-radius:99em;transform:translateZ(-1.19em);box-shadow:inset 0 0 0 .32em rgba(110,168,255,.9),inset 0 0 0 .38em rgba(255,255,255,.4)}+.back{inset:-.28em;transform:translateZ(.32em);background:radial-gradient(120% 140% at 50% 30%,#242d5a,#10142a 70%);box-shadow:inset 0 0 0 .4em #5b43b4,inset 0 0 0 .47em rgba(255,255,255,.38)}+.lens{transform:translateZ(-.24em);transform-style:preserve-3d}.lens span{position:absolute;inset:0;backface-visibility:hidden}.lens .b{transform:rotateY(180deg)}.lens i{position:absolute;top:50%;width:2.4em;aspect-ratio:1;margin:-1.2em 0 0 -1.2em;border-radius:50%}@@ -31,28 +39,17 @@ body{color:#f4f4f2;font:400 15px/1.5 'Schibsted Grotesk',system-ui,-apple-system.lens i:last-child{left:72%}.a i{background:radial-gradient(circle at 36% 30%,#4b5c93,#10142a 62%);box-shadow:inset 0 0 0 .08em rgba(63,214,196,.6)}.b i{background:#fff;box-shadow:inset 0 0 0 .14em #3fd6c4,inset 0 0 0 .3em #0e1226,inset 0 0 0 .44em #6ea8ff,inset 0 0 0 .6em #0e1226,inset 0 0 0 .74em #b98cff,inset 0 0 0 .96em #0e1226,var(--g2)}-.band{inset:-.28em -1.15em;border-width:.4em;border-radius:99em;background:linear-gradient(90deg,#ff6f8b,#ff9d5c 50%,#ff6f8b) border-box}-.floor{position:absolute;left:50%;top:50%;width:11em;height:1.5em;margin:5em 0 0 -5.5em;border-radius:50%;background:radial-gradient(closest-side,rgba(110,168,255,.4),transparent)}-.story{grid-area:1/1;position:relative;padding-top:calc(var(--rest) - var(--B) / 2)}-.blk{height:var(--B);display:flex;align-items:center;padding:0 16px}-.card{width:100%;max-width:26em;margin:0 auto;padding:.62em .9em .68em;border-radius:14px;background:rgba(14,14,20,.92);border:1px solid rgba(255,255,255,.1);box-shadow:inset 3px 0 0 var(--c,#8b8b99)}-h1,h2{font-size:clamp(19px,1.2vw + 12px,30px);line-height:1.15;font-weight:700;letter-spacing:-.01em;text-wrap:balance}-.card p{margin-top:.4em;font-size:clamp(15px,.45vw + 12px,17px);color:#c3c4d0;text-wrap:pretty}+.band{inset:-.28em -1.15em;border-width:.4em;border-radius:99em;transform:translateZ(-.8em);background:linear-gradient(90deg,#ff6f8b,#ff9d5c 50%,#ff6f8b) border-box}+.top,.end{position:absolute;left:0;right:0;margin:0 auto;width:min(26em,calc(100% - 32px));text-align:center;z-index:1}+.top{top:0;padding-top:16px}+.end{bottom:0;padding-bottom:14px}+h1,h2{font-size:clamp(18px,1.2vw + 12px,30px);line-height:1.15;font-weight:700;letter-spacing:-.01em;text-wrap:balance}+.top p,.end p,.still p{margin-top:.4em;font-size:clamp(15px,.45vw + 12px,17px);color:#c3c4d0;text-wrap:pretty}.stills{display:none;max-width:920px;margin:auto;padding:48px clamp(16px,4vw,40px) clamp(16px,4vw,40px)}.still{display:grid;gap:8px 28px;align-items:center;margin:28px 0}-.pic .scene{position:relative;width:100%;height:calc(var(--w) * .88);--w:min(60vw,300px,calc(var(--H) * .62))}-.still p{margin-top:.4em;color:#c3c4d0}-@media(min-height:480px){.track{--f:.35 .9 .35 .9 0}}-@media(min-width:640px) and (min-aspect-ratio:13/10){- .track{--B:calc(var(--H) * .5);--rest:calc(var(--H) / 2);--top:0px;--f:.35 .9 .35 .9 0;--sh:var(--H);--gx:28%}- .scene{width:56%;--w:min(38vw,calc(var(--H) * .92),540px)}- .story{margin-left:56%}- .blk{padding:0 clamp(16px,4vw,48px) 0 0}- .card{margin:0;max-width:22em;background:none;border:0;border-radius:0;padding:.1em 0 .1em 1.1em}-}+.pic .scene{position:relative;inset:auto;width:100%;--w:min(60vw,300px,calc(var(--H) * .62));--sh:calc(var(--w) * 1.1);height:var(--sh);overflow:hidden;border-radius:14px;border:1px solid rgba(255,255,255,.08);background:radial-gradient(circle at 50% 42%,rgba(110,168,255,.18),transparent 70%),#0b0b0f}@media(min-width:640px){.still{grid-template-columns:1fr 1fr}}.lite .glass{--s2:linear-gradient(#0000,#0000)}-.lite .floor{display:none}@media(prefers-reduced-motion:reduce){.track{display:none}.stills{display:block}}</style><script>@@ -67,68 +64,53 @@ h1,h2{font-size:clamp(19px,1.2vw + 12px,30px);line-height:1.15;font-weight:700;l<body><main class="track"><div class="stage">- <div class="scene" role="img" aria-label="A wide, rounded visor drawn in four layers: a blue and teal glass front, a violet frame, two round lenses and a soft coral band. Scrolling lifts the layers apart, then tips the visor up to show its lenses.">- <div class="obj">- <div class="l glass"></div>- <div class="l frame"></div>+ <div class="scene" role="img" aria-label="A wide, rounded visor drawn in layers. First its parts, a blue and teal glass, a violet frame and two thin plates, rise apart as a stack and are carried off the top. Then the body, a dark back with two round lenses ringed in light and a coral band, swings up behind them and turns to face you.">+ <div class="pw pb"><div class="obj body">+ <div class="l back"></div><div class="l lens"><span class="a"><i></i><i></i></span><span class="b"><i></i><i></i></span></div><div class="l band"></div>- </div>- <div class="floor"></div>+ </div></div>+ <div class="pw pp"><div class="obj parts">+ <div class="l glass"></div>+ <div class="l frame"></div>+ <div class="l pl1"></div>+ <div class="l pl2"></div>+ </div></div></div></div>- <div class="story">- <div class="blk"><div class="card"><h1>Scroll to take it apart <span aria-hidden="true">↓</span></h1></div></div>- <div class="blk" style="--c:#6ea8ff"><div class="card"><h2>Glass up front</h2><p>One smooth curved pane covers the face and catches the light.</p></div></div>- <div class="blk" style="--c:#b98cff"><div class="card"><h2>A frame that holds it</h2><p>A ring of violet metal grips the glass and gives the visor its shape.</p></div></div>- <div class="blk" style="--c:#3fd6c4"><div class="card"><h2>Two round lenses</h2><p>They sit on the inside, each wrapped in its own rings of light.</p></div></div>- <div class="blk" style="--c:#ff9d5c"><div class="card"><h2>A soft band behind</h2><p>It wraps around the back and keeps everything snug.</p></div></div>- <div class="blk"><div class="card"><h2>Scroll back up to put it together <span aria-hidden="true">↑</span></h2></div></div>- </div>+ <header class="top"><h1>A visor, taken apart</h1><p>Scroll, and its parts lift away one above the other and rise out of sight.</p></header>+ <footer class="end"><h2>Two lenses face you</h2><p>With the front parts gone, the body turns round and shows its lenses, each ringed in light.</p></footer></main><section class="stills">- <h1>The visor in four pictures</h1>- <figure class="still"><div class="pic" data-alt="The visor whole, with its four layers fitted together"></div><figcaption><h2>All in one piece</h2><p>A glass front, a violet frame, two lenses and a soft band, fitted together.</p></figcaption></figure>- <figure class="still"><div class="pic" data-alt="The visor with its four layers lifted apart, one above the other"></div><figcaption><h2>Taken apart</h2><p>The glass lifts away first, then the frame, the lenses and the band, each on its own layer.</p></figcaption></figure>- <figure class="still"><div class="pic" data-alt="The visor tipped up so its back shows the two round lenses"></div><figcaption><h2>Tipped up</h2><p>Turned over, the back shows the two round lenses, each wrapped in rings of light.</p></figcaption></figure>- <figure class="still"><div class="pic" data-alt="The visor back together"></div><figcaption><h2>Back together</h2><p>Everything fits back into place, ready to be taken apart again.</p></figcaption></figure>+ <h1>The visor in three pictures</h1>+ <figure class="still"><div class="pic" data-alt="A stack of the visor's parts, a glass, a frame and two thin plates, lifted apart one above the other"></div><figcaption><h2>A stack of parts</h2><p>The glass, the frame and two thin plates lift apart, one above the other.</p></figcaption></figure>+ <figure class="still"><div class="pic" data-alt="The body of the visor, seen at a slant, swinging up and starting to turn toward you"></div><figcaption><h2>The body swings up</h2><p>Behind them, the body rises and starts to turn toward you.</p></figcaption></figure>+ <figure class="still"><div class="pic" data-alt="The body of the visor facing you, its two round lenses ringed in light in the middle"></div><figcaption><h2>Two lenses face you</h2><p>With the front parts gone, the body turns round and shows its lenses, each ringed in light.</p></figcaption></figure></section><script>const $ = s => document.querySelector(s), $$ = s => [...document.querySelectorAll(s)];const clamp = (v, a, b) => Math.min(Math.max(v, a), b);const ss = (a, b, x) => { x = clamp((x - a) / (b - a), 0, 1); return x * x * (3 - 2 * x); };-const reduce = matchMedia('(prefers-reduced-motion: reduce)'), FRAME = 1000 / 60, UMAX = 5.3;-const Z0 = [.12, .08, .04, 0], Z1 = [3.35, .85, -1.25, -3.35], WIN = [[.45, 1.5], [1.5, 2.5], [2.5, 3.5], [3.5, 4.3]];-const parts = r => ({ ls: [...r.querySelectorAll('.l')], o: r.firstElementChild, f: r.querySelector('.floor') });+const reduce = matchMedia('(prefers-reduced-motion: reduce)'), FRAME = 1000 / 60, SF = 1.7;+const ZP = [3.4, 1.1, -1.1, -3.4], XP = [7, 5, 3, 1.5], ZB = [.4, -.3, -1];+const parts = r => ({ pl: [...r.querySelectorAll('.parts .l')], bl: [...r.querySelectorAll('.body .l')], pp: r.querySelector('.pp'), bo: r.querySelector('.body'), pb: r.querySelector('.pb') });-function pose(p, u) {- const lift = ss(.2, 1.5, u), tip = ss(4.3, 5.1, u), spread = 1 - .7 * ss(.25, 1, tip);- p.ls.forEach((el, i) => {- const e = ss(WIN[i][0], WIN[i][1], u);- el.style.transform = `translateZ(${((Z0[i] + (Z1[i] - Z0[i]) * e) * spread).toFixed(3)}em)`;- });- p.o.style.transform = `rotateY(${(12 + 8 * lift - 6 * tip).toFixed(2)}deg) rotateX(${(8 + 60 * lift + 120 * tip).toFixed(2)}deg)`;- p.f.style.transform = `scaleX(${(1 + .3 * lift).toFixed(3)})`;- p.f.style.opacity = (.9 - .5 * lift).toFixed(3);+function pose(p, s) {+ const spread = .35 + .65 * ss(0, 1.2, s), carry = ss(.7, 1.7, s), t = ss(.8, SF, s), sb = .3 + .5 * (1 - t);+ p.pl.forEach((el, i) => { el.style.transform = `translateZ(${(ZP[i] * spread + XP[i] * carry).toFixed(3)}em)`; });+ p.pp.style.transform = `translateY(calc(var(--sh) * ${(.5 - .85 * s).toFixed(4)}))`;+ p.bl.forEach((el, i) => { el.style.transform = `translateZ(${(ZB[i] * sb).toFixed(3)}em)`; });+ p.pb.style.transform = `translateY(calc(var(--sh) * ${(-.08 + .67 * Math.max(0, SF - s)).toFixed(4)}))`;+ p.bo.style.transform = `rotateY(${(-10 + 24 * t).toFixed(2)}deg) rotateX(${(100 + 88 * t).toFixed(2)}deg)`;}-const main = parts($('.scene')), cards = $$('.card'), blks = $$('.blk');-let B = 1, END = 0, F = [.35, .9, .35, .9, 0], cur = 0, tgt = 0, raf = 0, lastT = null, playing = false, pos = 0, acted = false;+const main = parts($('.scene')), stage = $('.stage');+let H = 1, END = 0, SMAX = 2.3, cur = 0, tgt = 0, raf = 0, lastT = null, playing = false, pos = 0, acted = false;function measure() {- const s = getComputedStyle(blks[0]);- B = blks[0].offsetHeight || 1; END = document.documentElement.scrollHeight - innerHeight;- F = s.getPropertyValue('--f').trim().split(/\s+/).map(Number);-}-function paint(y) {- pose(main, cur);- cards.forEach((c, i) => {- const d = y / B - i, k = d < 0 ? 0 : 2, o = i === 5 && d > 0 ? 1 : 1 - ss(F[k], F[k + 1], Math.abs(d));- c.style.opacity = o < .02 ? 0 : o.toFixed(3);- if (F[4]) c.style.transform = `translateY(${((y - i * B) * F[4]).toFixed(1)}px)`;- });+ H = stage.clientHeight || 1; END = document.documentElement.scrollHeight - innerHeight; SMAX = END / H;}-function snap() { cur = tgt = clamp(scrollY / B, 0, UMAX); if (!reduce.matches) paint(scrollY); }+function snap() { cur = tgt = clamp(scrollY / H, 0, SMAX); if (!reduce.matches) pose(main, cur); }function tick(ts) {raf = 0;@@ -141,11 +123,11 @@ function tick(ts) {}const y = scrollY;if (playing && Math.abs(y - pos) > 3) playing = false;- tgt = clamp(y / B, 0, UMAX);+ tgt = clamp(y / H, 0, SMAX);if (Math.abs(tgt - cur) > 1.5) cur = tgt;cur += (tgt - cur) * (1 - Math.pow(1 - .14, (first ? FRAME : dt) / FRAME));- if (Math.abs(tgt - cur) < .0008) cur = tgt;- if (!reduce.matches) paint(y);+ if (Math.abs(tgt - cur) < .0004) cur = tgt;+ if (!reduce.matches) pose(main, cur);if (playing || cur !== tgt) raf = requestAnimationFrame(tick); else lastT = null;}const wake = () => { if (!raf) raf = requestAnimationFrame(tick); };@@ -172,8 +154,7 @@ $$('.pic').forEach((pic, i) => {const c = $('.scene').cloneNode(true);c.setAttribute('aria-label', pic.dataset.alt);pic.append(c);- pose(parts(c), [0, 4.3, 5.1, 0][i]);- if (i === 3) c.firstElementChild.style.transform = 'rotateY(-14deg) rotateX(8deg)';+ pose(parts(c), [.62, 1.45, SF][i]);});measure(); snap();addEventListener('load', () => {