Skip to content
OwnlyPlans

pavement-posters.html

The finished file. Open it in a browser. Edit posters in P and the 7 photo URLs in PHOTOS; all poster art is drawn in DESIGNS.

Part of Pavement poster portfolio by Admin

Download Open the item

<!DOCTYPE html> <html lang="en" data-theme="night"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="#0b0a09" /> <title>Gully Press — Posters & printed matter</title> <link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link href="https://fonts.googleapis.com/css2?family=Familjen+Grotesk:wght@400..700&family=Instrument+Serif:ital@0;1&family=Anton&family=DM+Mono&family=Caveat:wght@500&display=swap" rel="stylesheet" /> <style> :root{--font:"Familjen Grotesk",system-ui,-apple-system,"Segoe UI",sans-serif;--ease:cubic-bezier(.16,1,.3,1);--pad:clamp(18px,3vw,38px);--active:#e8e1d3} html[data-theme="night"]{--bg:#0b0a09;--fg:#f1ece4;--mute:rgba(241,236,228,.55);--soft:rgba(241,236,228,.3);--line:rgba(241,236,228,.12);--pill:rgba(22,20,18,.7);--pillb:rgba(255,255,255,.1);--panel:rgba(16,15,13,.88);--chip:#f1ece4;--chipink:#111} html[data-theme="day"]{--bg:#d9d4cb;--fg:#141210;--mute:rgba(20,18,16,.6);--soft:rgba(20,18,16,.3);--line:rgba(20,18,16,.12);--pill:rgba(255,255,255,.62);--pillb:rgba(0,0,0,.08);--panel:rgba(245,242,236,.92);--chip:#141210;--chipink:#f1ece4} *{box-sizing:border-box;margin:0;padding:0} html,body{background:var(--bg);color:var(--fg);transition:background .8s,color .8s} body{font-family:var(--font);-webkit-font-smoothing:antialiased;overflow-x:hidden;overscroll-behavior-y:none} button{font:inherit;color:inherit;background:none;border:0;cursor:pointer} a{color:inherit;text-decoration:none} html.locked,html.locked body{overflow:hidden} #gl{position:fixed;inset:0;width:100%;height:100%;display:block;z-index:0;touch-action:pan-y} #space{position:relative;z-index:-1} .grain{position:fixed;inset:-50%;z-index:2;pointer-events:none;opacity:.08;mix-blend-mode:overlay; background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");animation:grain 1s steps(6) infinite} @keyframes grain{0%{transform:translate(0,0)}25%{transform:translate(-3%,2%)}50%{transform:translate(2%,-3%)}75%{transform:translate(-2%,-1%)}100%{transform:translate(0,0)}}

#loader{position:fixed;inset:0;z-index:100;background:#0b0a09;display:grid;place-items:center;transition:opacity 1.1s var(--ease),visibility 1.1s} #loader.done{opacity:0;visibility:hidden} #loader span{width:56px;height:78px;border:1.5px solid rgba(241,236,228,.5);border-radius:2px;animation:lp 1.4s infinite var(--ease)} @keyframes lp{50%{transform:rotate(8deg) translateY(-6px);opacity:.5}}

/ top bar / .top{position:fixed;top:0;left:0;right:0;z-index:30;display:flex;justify-content:space-between;align-items:flex-start;padding:var(--pad);pointer-events:none} .top>*{pointer-events:auto} .logo b{display:block;font-weight:700;font-size:clamp(22px,2vw,27px);letter-spacing:-.035em;line-height:1} .logo small{display:block;margin-top:7px;font-size:clamp(12px,1vw,14px);color:var(--mute)} .acts{display:flex;gap:8px;transition:opacity .5s var(--ease),transform .5s var(--ease)} .btn{height:38px;padding:0 16px;border-radius:999px;background:var(--pill);border:1px solid var(--pillb);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);font-size:15px;font-weight:600;letter-spacing:-.02em;display:inline-flex;align-items:center;gap:4px;transition:transform .3s var(--ease)} .btn:hover{transform:translateY(-1px)} .btn sup{font-size:10px;opacity:.6;margin-top:-10px} .btn.round{width:38px;padding:0;justify-content:center} .btn svg{width:16px;height:16px} .close{position:fixed;top:var(--pad);right:var(--pad);z-index:31;width:42px;height:42px;opacity:0;transform:scale(.8) rotate(-45deg);pointer-events:none;transition:opacity .5s var(--ease),transform .6s var(--ease)} .case-open .close{opacity:1;transform:none;pointer-events:auto;transition-delay:.3s} .case-open .acts{opacity:0;transform:translateY(-8px);pointer-events:none}

/ contact / .contact{position:fixed;z-index:29;top:calc(var(--pad) + 48px);right:var(--pad);width:min(330px,calc(100vw - 2*var(--pad)));padding:20px 18px 16px;border-radius:18px;background:var(--panel);border:1px solid var(--line);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);opacity:0;transform:translateY(-8px) scale(.97);transform-origin:top right;pointer-events:none;transition:opacity .4s var(--ease),transform .5s var(--ease)} .contact-open .contact{opacity:1;transform:none;pointer-events:auto} .contact p{font-size:15px;line-height:1.42;color:color-mix(in srgb,var(--fg) 82%,transparent)} .mail{margin-top:16px;display:flex;align-items:center;justify-content:space-between;height:46px;padding:0 10px 0 16px;border-radius:999px;border:1px solid var(--line);font-weight:600;font-size:15px} .mail button{width:30px;height:30px;border-radius:8px;display:grid;place-items:center} .mail button svg{width:15px;height:15px} .socials{margin-top:14px;display:flex;gap:16px;font-size:13px;color:var(--mute)}

/ hero copy / .hero{position:fixed;left:var(--pad);bottom:calc(var(--pad) + 4px);z-index:20;pointer-events:none;max-width:calc(100vw - 2*var(--pad));transition:opacity .6s var(--ease),transform .7s var(--ease)} .index-open .hero,.case-open .hero,.at-end .hero{opacity:0;transform:translateX(-24px)} body:not(.ready) .hero,body:not(.ready) .ticks{opacity:0} .count{display:flex;align-items:center;gap:6px;font-size:13px;font-weight:700;margin-bottom:4px} .count .wheel{display:inline-block;height:1.15em;overflow:hidden;position:relative;min-width:1.4em} .count .wheel span{display:block;line-height:1.15em} .count em{font-style:normal;color:var(--mute);font-weight:500} .title{font-weight:700;font-size:clamp(50px,7vw,100px);letter-spacing:-.05em;line-height:1.02;white-space:nowrap} .meta{margin-top:8px;display:flex;align-items:center;gap:10px;font-size:clamp(13px,1.15vw,16px);font-weight:600;color:color-mix(in srgb,var(--fg) 86%,transparent)} .meta i{width:11px;height:11px;border-radius:2px;background:var(--active);box-shadow:0 0 0 1px rgba(255,255,255,.18);transition:background .6s} .hint{margin-top:24px;display:flex;align-items:center;gap:12px;font-size:13px;color:var(--mute)} .hint::before{content:"";width:1px;height:18px;background:var(--soft)}

/ right index ticks / .ticks{position:fixed;right:var(--pad);top:50%;transform:translateY(-50%);z-index:20;display:flex;flex-direction:column;align-items:flex-end;gap:2px;transition:opacity .5s} .case-open .ticks,.at-end .ticks{opacity:0;pointer-events:none} .ticks button{display:flex;align-items:center;gap:10px;height:22px;font-size:13px;font-weight:600;letter-spacing:-.01em} .ticks button span{opacity:0;transform:translateX(6px);transition:opacity .35s,transform .45s var(--ease);color:var(--mute);white-space:nowrap} .ticks button i{width:14px;height:1.5px;background:var(--soft);transition:width .45s var(--ease),background .45s} .ticks button.on span{opacity:1;transform:none;color:var(--fg)} .ticks button.on i{width:34px;background:var(--fg)} .ticks:hover button span{opacity:1;transform:none} .ticks button:hover i{background:var(--fg)}

/ hover pill / .hpill{position:fixed;left:0;top:0;z-index:40;pointer-events:none;display:flex;align-items:center;gap:8px;padding:8px 14px;border-radius:999px;background:var(--chip);color:var(--chipink);font-size:14px;font-weight:700;white-space:nowrap;opacity:0;transform:translate(14px,-50%) scale(.85);transform-origin:left center;transition:opacity .25s,transform .35s var(--ease)} .hpill.on{opacity:1;transform:translate(18px,-50%) scale(1)} .hpill span{font-weight:500;opacity:.55} @media (hover:none){.hpill{display:none}}

/ index panel / .index{position:fixed;z-index:25;left:var(--pad);top:calc(var(--pad) + 62px);bottom:calc(var(--pad) + 4px);width:min(470px,calc(100vw - 2*var(--pad)));background:var(--panel);border:1px solid var(--line);border-radius:16px;backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);padding:6px 20px;overflow:auto;opacity:0;transform:translateX(-20px);pointer-events:none;transition:opacity .5s var(--ease),transform .6s var(--ease)} .index-open .index{opacity:1;transform:none;pointer-events:auto} .index button{width:100%;display:grid;grid-template-columns:30px 14px auto 1fr auto;align-items:center;gap:8px;padding:13px 0;border-bottom:1px solid var(--line);text-align:left;font-size:14px} .index button:last-child{border-bottom:0} .index .n{font-size:12px;color:var(--mute)} .index .d{width:10px;height:10px;border-radius:50%;box-shadow:0 0 0 1px rgba(255,255,255,.2)} .index .b{font-weight:700;font-size:16px;letter-spacing:-.02em;color:var(--mute)} .index .c{color:var(--mute);opacity:.75;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} .index .y{font-size:12px;color:var(--mute)} .index button:hover .b,.index button.cur .b{color:var(--fg)}

/ case / .case{position:fixed;inset:0;z-index:22;pointer-events:none;display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:clamp(24px,4vw,56px);padding:calc(var(--pad) + 60px) var(--pad) var(--pad);align-items:center} .case-open .case{pointer-events:auto} .media{height:min(74vh,640px)} .panel{max-width:430px;width:100%} .panel>{opacity:0;transform:translateY(18px);transition:opacity .6s var(--ease),transform .8s var(--ease)} .case.show .panel>{opacity:1;transform:none} .case.show .panel>:nth-child(2){transition-delay:.05s}.case.show .panel>:nth-child(3){transition-delay:.1s}.case.show .panel>:nth-child(4){transition-delay:.15s}.case.show .panel>:nth-child(5){transition-delay:.2s}.case.show .panel>:nth-child(6){transition-delay:.25s} .case.swap .panel>{opacity:0!important;transform:translateY(-10px)!important;transition-delay:0s!important;transition-duration:.25s!important} .k{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:600;color:var(--mute)} .k i{width:8px;height:8px;border-radius:50%;background:var(--active)} .panel h2{margin-top:10px;font-weight:700;font-size:clamp(40px,4.4vw,62px);letter-spacing:-.05em;line-height:1} .panel h3{margin-top:10px;font-weight:700;font-size:clamp(17px,1.4vw,20px);letter-spacing:-.02em} .panel p{margin-top:16px;font-size:clamp(14px,1.15vw,16px);line-height:1.5;color:var(--fg);color:color-mix(in srgb,var(--fg) 75%,transparent);max-width:38ch} .rows{margin-top:22px} .rows div{display:flex;justify-content:space-between;gap:16px;padding:11px 0;border-top:1px solid var(--line);font-size:14px} .rows div span:first-child{color:var(--mute)} .rows div span:last-child{font-weight:700;text-align:right} .cta{margin-top:22px;display:flex;justify-content:space-between;align-items:center;gap:12px} .full{height:46px;padding:0 22px;border-radius:999px;background:var(--fg);color:var(--bg);font-size:15px;font-weight:700;display:inline-flex;align-items:center;gap:10px;transition:transform .3s var(--ease)} .full:hover{transform:scale(1.04)} .nextp{text-align:right;font-size:13px;color:var(--mute)} .nextp b{display:block;color:var(--fg);font-size:14px}

/ outro / .outro{position:fixed;left:var(--pad);bottom:calc(var(--pad) + 4px);z-index:20;pointer-events:none;opacity:0;transform:translateY(30px);transition:opacity .8s var(--ease),transform 1s var(--ease)} .at-end .outro{opacity:1;transform:none;pointer-events:auto} .outro h2{font-weight:700;font-size:clamp(50px,7vw,100px);letter-spacing:-.05em;line-height:1.02} .outro h2 em{font-style:normal;color:var(--mute)} .outro .meta{color:color-mix(in srgb,var(--fg) 75%,transparent)} .outro .go{margin-top:20px;display:flex;flex-wrap:wrap;gap:10px} .outro .full{height:50px}

@media (max-width:860px){ .case{grid-template-columns:1fr;grid-template-rows:auto 1fr;align-items:start;gap:16px;padding-top:calc(var(--pad) + 62px);overflow:hidden} .media{height:36vh} .panel{max-width:none;overflow:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;height:100%;padding-bottom:20px} .ticks button span{display:none} .ticks button.on i{width:22px} } @media (max-width:560px){ .logo small{max-width:160px} .btn{height:34px;padding:0 12px;font-size:14px}.btn.round{width:34px} .title,.outro h2{font-size:clamp(40px,12.5vw,58px)} .hero,.outro{bottom:calc(var(--pad) + 6px)} .hint{margin-top:14px} .index .c{display:none}.index button{grid-template-columns:28px 14px 1fr auto} .ticks{right:12px} } @media (prefers-reduced-motion:reduce){.grain{animation:none}} </style> </head> <body> <div id="loader"><span></span></div> <canvas id="gl" aria-label="Posters lying on a street at night"></canvas> <div class="grain"></div> <div id="space"></div>

<header class="top"> <a href="#" class="logo"><b>Gully Press</b><small>Posters & printed matter, Vizag</small></a> <div class="acts"> <button class="btn round" id="theme" aria-label="Switch day or night"><svg id="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg></button> <button class="btn" id="indexBtn">Index<sup>10</sup></button> <button class="btn" id="contactBtn">Contact</button> </div> </header> <button class="btn round close" id="close" aria-label="Put the poster down"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>

<div class="contact" id="contact" role="dialog" aria-label="Contact"> <p>A two-person print studio near the beach road. We design and print posters for libraries, galleries, festivals and the odd chai shop: riso, screen, offset and letterpress.</p> <div class="mail"><a href="mailto:hello@gullypress.in">hello@gullypress.in</a><button id="copy" aria-label="Copy email"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V6a2 2 0 0 1 2-2h9"/></svg></button></div> <div class="socials"><a href="#">Instagram</a><a href="#">Are.na</a><a href="#">Shop</a></div> </div> <nav class="index" id="index" aria-label="Poster index"></nav>

<section class="hero" id="hero"> <div class="count"><span class="wheel" id="wheel"><span>01</span></span><em>/ 10</em></div> <h1 class="title" id="title">Poster</h1> <div class="meta"><i></i><span id="meta"></span></div> <div class="hint" id="hint">Scroll to walk the street · click a poster to pick it up</div> </section> <nav class="ticks" id="ticks" aria-label="Posters"></nav> <div class="hpill" id="hpill"><b id="hname"></b><span>Pick up</span></div>

<section class="case" id="case" aria-hidden="true"> <div class="media" id="media"></div> <div class="panel"> <div class="k"><i></i><span id="ck"></span></div> <h2 id="cb"></h2> <h3 id="cc"></h3> <p id="cd"></p> <div class="rows" id="cr"></div> <div class="cta"><a class="full" href="mailto:hello@gullypress.in">Request a print <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M5 12h14M13 6l6 6-6 6"/></svg></a><button class="nextp" id="nextp">Next poster<b id="nextn"></b></button></div> </div> </section>

<section class="outro" id="outro"> <div class="count"><span>End</span><em>/ 10 posters</em></div> <h2>Start a project<em>.</em></h2> <div class="meta"><span><b>Your poster could be next.</b> · Booking spring 2027 · Riso to letterpress</span></div> <div class="go"><a class="full" href="mailto:hello@gullypress.in">Commission a poster <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M5 12h14M13 6l6 6-6 6"/></svg></a><button class="btn" id="restart" style="height:50px;padding:0 20px">Back to 01</button></div> </section>

<script type="importmap"> { "imports": { "three": "https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js", "gsap": "https://cdn.jsdelivr.net/npm/gsap@3.12.5/+esm" } } </script> <script type="module"> import * as THREE from 'three'; import { gsap } from 'gsap';

/ ================================================================ PHOTOS used inside some posters (free Unsplash photos). Swap any URL for your own (it needs CORS) or a local path. ================================================================ / const PHOTOS = { sea: 'https://images.unsplash.com/photo-1510279770292-4b34de9f5c23?auto=format&fit=crop&w=800&h=800&q=75', night: 'https://images.unsplash.com/photo-1498036882173-b41c28a8ba34?auto=format&fit=crop&w=800&h=800&q=75', dance: 'https://images.unsplash.com/photo-1485889397316-8393dd065127?auto=format&fit=crop&w=800&h=800&q=75', rose: 'https://images.unsplash.com/photo-1500412830877-c77d92c33203?auto=format&fit=crop&w=800&h=800&q=75', bulbs: 'https://images.unsplash.com/photo-1473308822086-710304d7d30c?auto=format&fit=crop&w=800&h=800&q=75', road: 'https://images.unsplash.com/photo-1476820865390-c52aeebb9891?auto=format&fit=crop&w=800&h=800&q=75', stone: 'https://images.unsplash.com/photo-1443890923422-7819ed4101c0?auto=format&fit=crop&w=800&h=800&q=75' };

/ ================================================================ POSTERS — copy, print specs, ground under each one. ground: slabs | asphalt | zebra | tiles | road leaf: dappled shade ================================================================ / const P = [ { name:'Quiet Hours', kind:'Reading series', client:'City Library', year:2026, dot:'#1f1d1b', ground:'slabs', leaf:0, design:'quiet', format:'A2', print:'Offset, two colours', run:'400', paper:'Uncoated 170 g', desc:'Readings after closing time, every Thursday in July. Big quiet type, a long list of names, and enough empty paper to feel like a library at night.' }, { name:'Salt & Sea', kind:'Exhibition', client:'Gallery Rushikonda', year:2025, dot:'#e5392b', ground:'slabs', leaf:0, design:'salt', format:'50 × 70', print:'Riso, red only', run:'250', paper:'Munken 120 g', desc:'One red ink, one beach and two dates. The photo is printed as a single riso layer so the sea goes slightly pink at the edges.' }, { name:'Night Bus', kind:'Self-initiated, no. 88', client:'Daily Poster', year:2026, dot:'#3d5b49', ground:'slabs', leaf:0, design:'bus', format:'A3', print:'Screen, three colours', run:'60', paper:'Colorplan 270 g', desc:'From a series of posters made in one evening each. This one is about the last bus home, the 28, and the city lights going past.' }, { name:'Fold', kind:'Poster series, no. 2', client:'Fold Paper Co.', year:2024, dot:'#efe6d2', ground:'asphalt', leaf:1, design:'fold', format:'A2', print:'Letterpress, one colour', run:'300', paper:'Cotton 300 g', desc:'A house poster for a shop that only sells paper. A monogram, a size and a promise, pressed deep enough into the cotton that you can feel it.' }, { name:'Now Open', kind:'Launch flyers', client:'Chai & Vinyl', year:2026, dot:'#f1e9d6', ground:'asphalt', leaf:1, design:'open', format:'A6 flyer', print:'Riso, black', run:'2,000', paper:'Recycled 100 g', desc:'Two thousand flyers for a record shop that also makes chai. Handed out on the beach road and, as you can see, mostly dropped.', pile:true }, { name:'Open Floor', kind:'Dance festival', client:'Kalabharathi', year:2025, dot:'#ef5a24', ground:'zebra', leaf:0, design:'floor', format:'A1', print:'Offset, four colours', run:'1,200', paper:'Silk 150 g', desc:'A three-night dance festival. One orange circle, one dancer, and a programme you can read from across the road.' }, { name:'Zine Fair', kind:'Print fair', client:'Small Press Vizag', year:2025, dot:'#e6408a', ground:'zebra', leaf:0, design:'zine', format:'A3', print:'Riso, pink and blue', run:'500', paper:'Riso 90 g', desc:'A fair for small presses, so the poster had to be riso: a halftone rose in blue over fluorescent pink, slightly out of register on purpose.' }, { name:'Under the Bridge', kind:'Open-air cinema', client:'Cinema by the Bay', year:2026, dot:'#e3b45c', ground:'tiles', leaf:0, design:'cinema', format:'A2', print:'Offset, gold + black', run:'600', paper:'Black 250 g', desc:'Films under the old bridge every Saturday in March. Gold ink on black paper, so it looks best at exactly the time people read it.' }, { name:'10K by Night', kind:'Night run', client:'Beach Road Runners', year:2025, dot:'#f5c518', ground:'road', leaf:0, design:'run', format:'A2', print:'Screen, yellow + black', run:'350', paper:'Fluoro 135 g', desc:'A ten-kilometre run along the beach road after dark. Fluorescent yellow so it glows under the streetlights it was pasted next to.' }, { name:'Soft Stone', kind:'Exhibition', client:'Visakha Museum', year:2026, dot:'#b9b2a5', ground:'slabs', leaf:0, design:'stone', format:'60 × 80', print:'Offset, duotone', run:'800', paper:'Uncoated 200 g', desc:'Sculpture, slowly. A single photo, a lot of margin and a serif that takes its time, for an exhibition about stone and patience.' }, ]; const N = P.length; const pad2 = n => String(n).padStart(2, '0'); const GROUND_ID = { slabs:0, asphalt:1, zebra:2, tiles:3, road:4 };

/ ================================================================ RENDERER ================================================================ / const isTouch = matchMedia('(hover: none)').matches; const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches; const canvas = document.getElementById('gl'); const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, powerPreference: 'high-performance' }); renderer.setPixelRatio(Math.min(devicePixelRatio, 2)); renderer.outputColorSpace = THREE.SRGBColorSpace; renderer.setClearColor(0x0b0a09, 1); const scene = new THREE.Scene(); const camera = new THREE.PerspectiveCamera(32, innerWidth / innerHeight, 0.1, 200); scene.add(camera);

const SEG = 9; // street distance between posters const PW = 3.0, PH = PW * 1.414; // poster size (A-series) let CAM_Z = 15.5;

/ ================================================================ SHARED GLSL: noise + light (lamp pool, blinds, leaves, day/night) ================================================================ / const GLSL_COMMON = uniform float uTime, uDay; uniform vec2 uRes; float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); } float noise(vec2 p){ vec2 i = floor(p), f = fract(p); vec2 u = f*f*(3.0-2.0*f); return mix(mix(hash(i), hash(i+vec2(1,0)), u.x), mix(hash(i+vec2(0,1)), hash(i+vec2(1,1)), u.x), u.y); } float fbm(vec2 p){ float v = 0.0, a = 0.5; for (int i = 0; i < 5; i++){ v += a*noise(p); p = p*2.03 + 7.1; a = 0.5; } return v; } vec3 lightAt(vec3 col, vec2 world, float leaf){ vec2 uv = gl_FragCoord.xy / uRes; vec2 c = uv - vec2(0.54, 0.58); c.x = uRes.x / uRes.y; float pool = exp(-dot(c, c) / 0.11); float blinds = smoothstep(0.26, 0.02, uv.x) step(0.5, fract((uv.x 0.8 + uv.y 0.5) 17.0)); float dap = smoothstep(0.44, 0.6, fbm(world 0.32 + vec2(uTime 0.021, uTime 0.013))); vec3 night = col (vec3(0.045, 0.042, 0.045) + vec3(1.15, 0.88, 0.6) pool 1.25); night = 1.0 - blinds 0.6; night = 1.0 - leaf dap 0.75; float vig = smoothstep(1.25, 0.35, length((uv - 0.5) vec2(uRes.x / uRes.y, 1.0))); night = mix(0.3, 1.0, vig); vec3 day = col vec3(1.42, 1.36, 1.26) (1.0 - dap 0.5 (0.45 + 0.55 leaf)) (1.0 - blinds 0.32); return mix(night, day, uDay); }; const shared = { uTime: { value: 0 }, uDay: { value: 0 }, uRes: { value: new THREE.Vector2(1, 1) } };

/ ================================================================ GROUND — one long procedural street, a different surface per poster ================================================================ / const types = new Float32Array(16), leaves = new Float32Array(16); for (let i = 0; i < 16; i++) { const p = P[Math.min(i, N - 1)]; types[i] = i >= N ? 0 : GROUND_ID[p.ground]; leaves[i] = i >= N ? 0 : p.leaf; } const groundMat = new THREE.ShaderMaterial({ uniforms: { ...shared, uSeg: { value: SEG }, uType: { value: types }, uLeaf: { value: leaves } }, vertexShader: varying vec2 vW; void main(){ vec4 w = modelMatrix vec4(position, 1.0); vW = w.xy; gl_Position = projectionMatrix viewMatrix w; }, fragmentShader: ${GLSL_COMMON} uniform float uSeg; uniform float uType[16]; uniform float uLeaf[16]; varying vec2 vW; vec3 slabs(vec2 p){ vec3 c = vec3(0.47, 0.44, 0.40) (0.9 + 0.12 fbm(p 1.3)) + (noise(p 55.0) - 0.5) 0.07; vec2 g = p / vec2(3.4, 3.4) + vec2(0.0, 0.5); vec2 f = abs(fract(g) - 0.5); float joint = smoothstep(0.488, 0.497, max(f.x, f.y)); c = 1.0 - joint 0.55; float crack = smoothstep(0.006, 0.0, abs(fbm(p vec2(0.9, 0.35) + 3.0) - 0.5 - 0.03 sin(p.x 3.0))) step(0.78, hash(floor(g))); c = 1.0 - crack 0.45; return c; } vec3 asphalt(vec2 p){ vec3 c = vec3(0.26, 0.25, 0.23) (0.88 + 0.2 fbm(p 0.7)); c += step(0.9, hash(floor(p 70.0))) 0.12 - step(0.92, hash(floor(p 70.0) + 3.0)) 0.08; return c + (noise(p 120.0) - 0.5) 0.05; } vec3 zebra(vec2 p, float cy){ vec3 c = asphalt(p); float band = step(abs(p.y - cy), 3.4) step(0.5, fract(p.x / 1.7)); float worn = smoothstep(0.32, 0.5, fbm(p 2.2)); return mix(c, vec3(0.78, 0.76, 0.71) (0.92 + 0.1 noise(p 30.0)), band worn); } vec3 tiles(vec2 p){ vec2 g = p / 0.85; vec2 id = floor(g); vec2 f = abs(fract(g) - 0.5); vec3 c = vec3(0.5, 0.48, 0.45) (0.9 + 0.12 hash(id)) + (noise(p 60.0) - 0.5) 0.05; return c (1.0 - smoothstep(0.46, 0.49, max(f.x, f.y)) 0.5); } vec3 road(vec2 p){ vec3 c = asphalt(p) 0.85; float lane = step(abs(p.x + 3.1), 0.09) step(0.42, fract(p.y / 3.0)); return mix(c, vec3(0.86, 0.74, 0.32), lane smoothstep(0.3, 0.5, fbm(p 3.0))); } vec3 surface(float t, vec2 p, float cy){ vec3 c = vec3(0.0); if (t < 0.5) c = slabs(p); else if (t < 1.5) c = asphalt(p); else if (t < 2.5) c = zebra(p, cy); else if (t < 3.5) c = tiles(p); else c = road(p); return c; } void main(){ float s = vW.y / uSeg; int i = int(clamp(floor(s + 0.5), 0.0, 15.0)); float cy = float(i) uSeg; vec3 c = surface(uType[i], vW, cy); // kerb between two surfaces float d = min(fract(s + 0.5), 1.0 - fract(s + 0.5)) uSeg; if (i > 0 && uType[i] != uType[i - 1] || i < 15 && uType[i] != uType[min(i + 1, 15)]) { float k = smoothstep(0.32, 0.26, d); c = mix(c, vec3(0.55, 0.53, 0.5) (0.9 + 0.1 noise(vW 20.0)), k); c = 1.0 - smoothstep(0.035, 0.0, abs(d - 0.32)) 0.5; } gl_FragColor = vec4(lightAt(c, vW, uLeaf[i]), 1.0); #include <colorspace_fragment> }, }); const ground = new THREE.Mesh(new THREE.PlaneGeometry(90, SEG (N + 6)), groundMat); ground.position.set(0, SEG (N + 6) / 2 - SEG * 2.5, 0); scene.add(ground);

/ ================================================================ POSTER ART — painted on canvas (all original designs) ================================================================ / const TW = 1024, TH = Math.round(1024 1.414); const photoImgs = {}; function font(w, size, fam) { return ${w} ${size}px ${fam}; } const F = { grot: '"Familjen Grotesk", sans-serif', serif: '"Instrument Serif", Georgia, serif', anton: 'Anton, Impact, sans-serif', mono: '"DM Mono", monospace' }; function cover(g, img, x, y, w, h) { if (!img) { g.fillStyle = 'rgba(0,0,0,.25)'; g.fillRect(x, y, w, h); return; } const ir = img.width / img.height, r = w / h; let sw = img.width, sh = img.height, sx = 0, sy = 0; if (ir > r) { sw = sh r; sx = (img.width - sw) / 2; } else { sh = sw / r; sy = (img.height - sh) / 2; } g.drawImage(img, sx, sy, sw, sh, x, y, w, h); } function tint(g, x, y, w, h, color, mode) { g.save(); g.globalCompositeOperation = mode || 'multiply'; g.fillStyle = color; g.fillRect(x, y, w, h); g.restore(); } function grayscale(g, x, y, w, h) { const d = g.getImageData(x, y, w, h); for (let i = 0; i < d.data.length; i += 4) { const l = d.data[i] .3 + d.data[i + 1] .59 + d.data[i + 2] * .11; d.data[i] = d.data[i + 1] = d.data[i + 2] = l; } g.putImageData(d, x, y); } function text(g, s, x, y, f, c, align) { g.font = f; g.fillStyle = c; g.textAlign = align || 'left'; g.fillText(s, x, y); } function rule(g, x1, y1, x2, y2, c, w) { g.strokeStyle = c; g.lineWidth = w || 2; g.beginPath(); g.moveTo(x1, y1); g.lineTo(x2, y2); g.stroke(); }

const DESIGNS = { quiet(g) { g.fillStyle = '#e9dfca'; g.fillRect(0, 0, TW, TH); text(g, 'City Library', 70, 110, font(600, 30, F.grot), '#262320'); text(g, 'Readings after dark', TW - 70, 140, font(400, 30, F.grot), '#262320', 'right'); text(g, 'Quiet', 80, 470, font(400, 300, F.serif), '#1d1b19'); text(g, 'Hours', 300, 700, font(400, 300, F.serif), '#1d1b19'); g.fillStyle = '#1d1b19'; g.fillRect(84, 560, 26, 26); g.fillRect(120, 560, 26, 26); rule(g, 80, 820, TW - 80, 820, '#1d1b19', 2.5); ['Readings after closing time', 'City Central Library', 'Thursdays in July, 9–11 pm'].forEach((s, k) => text(g, s, 80, 880 + k 40, font(400, 28, F.grot), '#2a2724')); [['03.07', 'Anu Varma'], ['10.07', 'Ravi Teja K.'], ['17.07', 'Meera Das'], ['24.07', 'Open floor']].forEach(([d, n], k) => { text(g, d, 600, 880 + k 40, font(500, 28, F.mono), '#2a2724'); text(g, n, 720, 880 + k 40, font(500, 28, F.grot), '#2a2724'); }); g.fillStyle = '#1d1b19'; g.fillRect(80, 1240, 34, 34); g.fillRect(122, 1240, 34, 34); g.fillRect(80, 1282, 34, 34); text(g, 'Free entry · citylibrary.in', TW - 80, TH - 90, font(400, 26, F.grot), '#2a2724', 'right'); }, salt(g) { g.fillStyle = '#f2e6d4'; g.fillRect(0, 0, TW, TH); const R = '#e5392b'; text(g, 'SALT & SEA', TW / 2, 230, font(400, 210, F.anton), R, 'center'); g.save(); g.beginPath(); g.rect(80, 300, 300, 300); g.clip(); cover(g, photoImgs.sea, 80, 300, 300, 300); grayscale(g, 80, 300, 300, 300); tint(g, 80, 300, 300, 300, R, 'screen'); g.restore(); text(g, 'PHOTOGRAPHS BY', 430, 330, font(500, 24, F.mono), R); text(g, 'NAINA', 430, 420, font(400, 96, F.anton), R); text(g, 'RAO', 430, 515, font(400, 96, F.anton), R); text(g, '12.09', 80, 800, font(400, 150, F.anton), R); text(g, '30.09', 80, 960, font(400, 150, F.anton), R); text(g, 'GALLERY', TW - 80, 820, font(400, 120, F.anton), R, 'right'); text(g, 'RUSHIKONDA', TW - 80, 940, font(400, 120, F.anton), R, 'right'); g.save(); g.beginPath(); g.rect(80, 1060, 260, 200); g.clip(); cover(g, photoImgs.sea, 80, 1060, 260, 200); grayscale(g, 80, 1060, 260, 200); tint(g, 80, 1060, 260, 200, '#2b6cb0', 'multiply'); g.restore(); text(g, 'OPENING FRI 12.09', TW - 80, 1170, font(400, 66, F.anton), R, 'right'); text(g, '6 PM', TW - 80, 1250, font(400, 66, F.anton), R, 'right'); text(g, 'Beach Road, Rushikonda · free', 80, TH - 70, font(500, 24, F.mono), R); }, bus(g) { g.fillStyle = '#3c5a48'; g.fillRect(0, 0, TW, TH); g.save(); g.beginPath(); g.rect(0, 560, TW, TH - 560); g.clip(); cover(g, photoImgs.night, 0, 560, TW, TH - 560); grayscale(g, 0, 560, TW, TH - 560); tint(g, 0, 560, TW, TH - 560, '#3c5a48', 'multiply'); tint(g, 0, 560, TW, TH - 560, 'rgba(255,120,90,.18)', 'screen'); g.restore(); const R = '#ff5b4a'; ['LAST', 'BUS', '23:40'].forEach((s, k) => text(g, s, 80, 250 + k 150, font(700, 170, F.grot), R)); text(g, 'ROUTE 28 · RTC COMPLEX → BEACH ROAD', 80, 700, font(500, 26, F.mono), '#f6d9c8'); text(g, 'DAILY POSTER', TW - 80, 120, font(500, 26, F.mono), '#f6d9c8', 'right'); text(g, 'NO. 88', TW - 80, 160, font(500, 26, F.mono), '#f6d9c8', 'right'); text(g, 'gullypress.in/daily', 80, TH - 70, font(500, 24, F.mono), '#f6d9c8'); }, fold(g) { g.fillStyle = '#efe6d2'; g.fillRect(0, 0, TW, TH); const C = '#2b2722'; text(g, 'f.', 90, 210, font(400, 150, F.serif), C); g.save(); g.translate(TW - 190, TH - 160); g.rotate(-Math.PI / 2); text(g, 'A2', 0, 0, font(700, 120, F.grot), C); rule(g, 0, 40, 520, 40, C, 3); text(g, 'POSTER', 0, 150, font(700, 120, F.grot), C); g.restore(); g.save(); g.translate(330, TH - 120); g.rotate(-Math.PI / 2); text(g, 'FOLD PAPER CO.', 0, 0, font(700, 44, F.grot), C); text(g, 'Paper for people who fold things.', 0, 50, font(400, 26, F.grot), C); text(g, 'Siripuram · since 2019', 0, 86, font(400, 26, F.grot), C); g.restore(); text(g, 'fold.in — no. 2 of 6', 90, TH - 80, font(400, 22, F.mono), C); }, open(g) { g.fillStyle = '#f2ead7'; g.fillRect(0, 0, TW, TH); const C = '#1c1a17'; text(g, 'Now', 80, 330, font(700, 260, F.grot), C); text(g, 'open.', 80, 560, font(700, 260, F.grot), C); rule(g, 80, 650, TW - 80, 650, C, 3); text(g, 'Chai & Vinyl', 80, 740, font(700, 64, F.grot), C); ['Records, chai and a very', 'small couch. Siripuram,', 'next to the bakery.'].forEach((s, k) => text(g, s, 80, 820 + k 50, font(400, 40, F.grot), C)); for (let y = 0; y < 9; y++) for (let x = 0; x < 9; x++) if ((x 7 + y 3 + x y) % 3 === 0 || x < 2 && y < 2 || x > 6 && y < 2 || x < 2 && y > 6) { g.fillStyle = C; g.fillRect(TW - 380 + x 34, TH - 420 + y 34, 32, 32); } text(g, 'Opening day: 2 May, 4 pm', 80, TH - 110, font(500, 30, F.mono), C); }, floor(g) { g.fillStyle = '#efe7d6'; g.fillRect(0, 0, TW, TH); const O = '#ef5a24', C = '#1b1a18'; text(g, 'Kalabharathi', 80, 110, font(600, 28, F.grot), C); text(g, 'Dance festival, 3 nights', TW - 80, 110, font(400, 28, F.grot), C, 'right'); g.save(); g.beginPath(); g.arc(TW / 2, 520, 340, 0, Math.PI 2); g.fillStyle = O; g.fill(); g.clip(); cover(g, photoImgs.dance, TW / 2 - 340, 180, 680, 680); grayscale(g, TW / 2 - 340, 180, 680, 680); tint(g, TW / 2 - 340, 180, 680, 680, O, 'multiply'); g.restore(); text(g, 'Open', 80, 1060, font(700, 190, F.grot), C); text(g, 'Floor', 80, 1230, font(700, 190, F.grot), C); [['FRI 14', 'Kuchipudi now'], ['SAT 15', 'Floor work'], ['SUN 16', 'Open floor']].forEach(([d, n], k) => { text(g, d, 640, 960 + k 56, font(500, 30, F.mono), C); text(g, n, 760, 960 + k 56, font(600, 30, F.grot), C); }); rule(g, 640, 1150, TW - 80, 1150, C, 2); text(g, 'Doors 7 pm', 640, 1200, font(500, 28, F.mono), C); }, zine(g) { g.fillStyle = '#ff6fae'; g.fillRect(0, 0, TW, TH); const B = '#1f4fd1'; const img = photoImgs.rose; if (img) { const tmp = document.createElement('canvas'); tmp.width = 120; tmp.height = 150; const t = tmp.getContext('2d', { willReadFrequently: true }); cover(t, img, 0, 0, 120, 150); const d = t.getImageData(0, 0, 120, 150).data; g.fillStyle = B; for (let y = 0; y < 150; y++) for (let x = 0; x < 120; x++) { const i = (y 120 + x) 4; const l = (d[i] .3 + d[i + 1] .59 + d[i + 2] .11) / 255; const r = (1 - l) 4.4; if (r > .3) { g.beginPath(); g.arc(120 + x 6.6 + 6, 90 + y 6.6 + 6, r, 0, Math.PI 2); g.fill(); } } } text(g, 'ZINE', 70, 1180, font(400, 260, F.anton), B); text(g, 'FAIR', 560, 1180, font(400, 260, F.anton), B); g.beginPath(); g.arc(TW - 190, 1000, 110, 0, Math.PI 2); g.fillStyle = '#ffe14a'; g.fill(); text(g, 'SAT', TW - 190, 990, font(500, 34, F.mono), B, 'center'); text(g, '22.11', TW - 190, 1036, font(500, 34, F.mono), B, 'center'); text(g, 'Small Press Vizag · 40 tables · riso, zines, comics', 70, TH - 80, font(500, 24, F.mono), B); }, cinema(g) { g.fillStyle = '#141210'; g.fillRect(0, 0, TW, TH); const Gd = '#e3b45c'; g.save(); g.beginPath(); g.rect(80, 80, TW - 160, 560); g.clip(); cover(g, photoImgs.bulbs, 80, 80, TW - 160, 560); tint(g, 80, 80, TW - 160, 560, 'rgba(40,25,10,.25)', 'multiply'); g.restore(); text(g, 'Under the', 80, 800, font(400, 150, F.serif), Gd); g.font = italic 150px ${F.serif}; g.fillStyle = Gd; g.textAlign = 'left'; g.fillText('Bridge', 80, 940); text(g, 'Open-air cinema · Saturdays in March · 7:30 pm', 80, 1010, font(400, 26, F.grot), '#d9cdb5'); [['07.03', 'Pather Panchali'], ['14.03', 'Roja'], ['21.03', 'Swades'], ['28.03', 'Short films']].forEach(([d, n], k) => { const col = k % 2, row = Math.floor(k / 2); text(g, d, 80 + col 440, 1100 + row 56, font(500, 28, F.mono), Gd); text(g, n, 200 + col 440, 1100 + row 56, font(500, 28, F.grot), '#efe6d2'); }); text(g, 'Cinema by the Bay', 80, TH - 80, font(600, 26, F.grot), '#d9cdb5'); text(g, 'Bring a mat', TW - 80, TH - 80, font(400, 26, F.grot), '#d9cdb5', 'right'); }, run(g) { g.fillStyle = '#111'; g.fillRect(0, 0, TW, TH); const Y = '#f5c518'; g.save(); g.beginPath(); g.rect(0, 700, TW, TH - 700); g.clip(); cover(g, photoImgs.road, 0, 700, TW, TH - 700); grayscale(g, 0, 700, TW, TH - 700); tint(g, 0, 700, TW, TH - 700, 'rgba(245,197,24,.55)', 'multiply'); g.restore(); text(g, '10K', 70, 330, font(400, 300, F.anton), Y); text(g, 'BY NIGHT', 70, 560, font(400, 210, F.anton), Y); text(g, 'BEACH ROAD RUNNERS', 74, 640, font(500, 30, F.mono), Y); g.fillStyle = Y; g.fillRect(70, TH - 170, TW - 140, 100); text(g, 'SAT 13.12 · 21:00 · RK BEACH', TW / 2, TH - 102, font(400, 54, F.anton), '#111', 'center'); }, stone(g) { g.fillStyle = '#e4dfd5'; g.fillRect(0, 0, TW, TH); const C = '#2a2723'; rule(g, 80, 90, TW - 80, 90, C, 2); text(g, 'Visakha Museum', 80, 140, font(500, 26, F.grot), C); text(g, '14.02 – 30.05', TW - 80, 140, font(500, 26, F.grot), C, 'right'); g.fillStyle = '#d3cdc1'; g.fillRect(170, 220, TW - 340, 700); g.save(); g.beginPath(); g.rect(210, 260, TW - 420, 620); g.clip(); cover(g, photoImgs.stone, 210, 260, TW - 420, 620); grayscale(g, 210, 260, TW - 420, 620); tint(g, 210, 260, TW - 420, 620, '#c9bfae', 'multiply'); g.restore(); text(g, 'Soft Stone', TW / 2, 1090, font(400, 140, F.serif), C, 'center'); text(g, 'Sculpture, slowly. Twelve artists, one material.', TW / 2, 1150, font(400, 28, F.grot), C, 'center'); rule(g, 80, TH - 130, TW - 80, TH - 130, C, 2); text(g, 'Free on Sundays', 80, TH - 80, font(500, 24, F.grot), C); text(g, 'visakhamuseum.in', TW - 80, TH - 80, font(500, 24, F.grot), C, 'right'); }, }; function makePoster(p) { const c = document.createElement('canvas'); c.width = TW; c.height = TH; const g = c.getContext('2d', { willReadFrequently: true }); DESIGNS[p.design](g); // paper: faint fibres and a soft edge const d = g.getImageData(0, 0, TW, TH); for (let i = 0; i < d.data.length; i += 4) { const n = (Math.random() - .5) 10; d.data[i] += n; d.data[i + 1] += n; d.data[i + 2] += n; } g.putImageData(d, 0, 0); const t = new THREE.CanvasTexture(c); t.colorSpace = THREE.SRGBColorSpace; t.anisotropy = renderer.capabilities.getMaxAnisotropy(); return t; }

/ chalk outline + words for the end of the street / function chalkTex() { const c = document.createElement('canvas'); c.width = 1024; c.height = 1448; const g = c.getContext('2d', { willReadFrequently: true }); g.strokeStyle = 'rgba(245,242,235,.85)'; g.lineWidth = 9; g.lineCap = 'round'; g.setLineDash([46, 30]); g.strokeRect(40, 40, 944, 1368); g.setLineDash([]); g.fillStyle = 'rgba(245,242,235,.9)'; g.textAlign = 'center'; g.font = '500 150px Caveat, cursive'; g.fillText('your poster', 512, 640); g.fillText('here', 512, 800); g.lineWidth = 7; g.beginPath(); g.moveTo(330, 870); g.quadraticCurveTo(512, 930, 700, 860); g.stroke(); const d = g.getImageData(0, 0, 1024, 1448); for (let i = 3; i < d.data.length; i += 4) if (d.data[i] > 0) d.data[i] = .55 + Math.random() .45; g.putImageData(d, 0, 0); const t = new THREE.CanvasTexture(c); t.colorSpace = THREE.SRGBColorSpace; return t; } function shadowTex() { const c = document.createElement('canvas'); c.width = 256; c.height = 340; const g = c.getContext('2d', { willReadFrequently: true }); g.filter = 'blur(14px)'; g.fillStyle = '#000'; g.fillRect(40, 40, 176, 260); const t = new THREE.CanvasTexture(c); return t; } const SHADOW = shadowTex();

/ ================================================================ POSTER MESHES (curl in the vertex shader, same street light) ================================================================ / const posterGeo = new THREE.PlaneGeometry(PW, PH, 24, 34); const posterVert = uniform float uCurl, uWave, uTime, uSeed; varying vec2 vUv; varying vec2 vW; void main(){ vUv = uv; vec3 p = position; float ty = uv.y, tx = uv.x; p.z += uCurl (pow(ty, 2.2) 1.6 + pow(1.0 - tx, 2.0) 0.5); p.y -= uCurl pow(ty, 2.0) 0.35; p.z += uWave sin(tx 3.1 + uTime 2.4 + uSeed 6.0) 0.12 (0.4 + ty); vec4 w = modelMatrix vec4(p, 1.0); vW = w.xy; gl_Position = projectionMatrix viewMatrix w; }; const posterFrag = ${GLSL_COMMON} uniform sampler2D uTex; uniform float uOpacity, uFlat, uLeaf, uHover; varying vec2 vUv; varying vec2 vW; void main(){ vec3 c = texture2D(uTex, vUv).rgb; float edge = smoothstep(0.0, 0.03, min(min(vUv.x, 1.0 - vUv.x), min(vUv.y, 1.0 - vUv.y))); c = 0.9 + 0.1 edge; vec3 lit = lightAt(c, vW, uLeaf) (1.08 + uHover 0.12); vec3 flatc = c mix(0.92, 1.0, uDay); gl_FragColor = vec4(mix(lit, flatc, uFlat), uOpacity); #include <colorspace_fragment> }; function posterMaterial(tex, leaf) { return new THREE.ShaderMaterial({ uniforms: { ...shared, uTex: { value: tex }, uOpacity: { value: 1 }, uFlat: { value: 0 }, uLeaf: { value: leaf }, uHover: { value: 0 }, uCurl: { value: 0 }, uWave: { value: 0 }, uSeed: { value: Math.random() } }, vertexShader: posterVert, fragmentShader: posterFrag, transparent: true, side: THREE.DoubleSide, depthWrite: true, }); } const posters = []; const rnd = (a, b, s) => a + (b - a) ((Math.sin(s 91.7) 43758.5453) % 1 + 1) % 1; P.forEach((p, i) => { const mat = posterMaterial(null, p.leaf); const mesh = new THREE.Mesh(posterGeo, mat); mesh.userData.i = i; const sh = new THREE.Mesh(new THREE.PlaneGeometry(PW 1.25, PH 1.2), new THREE.MeshBasicMaterial({ map: SHADOW, transparent: true, depthWrite: false, color: 0x000000, opacity: .5 })); scene.add(sh); scene.add(mesh); const base = { x: rnd(-0.7, 0.9, i + 1), y: i SEG + rnd(-0.4, 0.4, i + 7), r: rnd(-0.32, 0.32, i + 3) }; const extras = []; if (p.pile) { mesh.scale.setScalar(0.5); for (let k = 0; k < 9; k++) { const m = new THREE.Mesh(posterGeo, mat.clone()); m.material.uniforms = { ...mat.uniforms, uOpacity: { value: 1 }, uCurl: { value: 0 }, uWave: { value: 0 }, uHover: { value: 0 }, uFlat: { value: 0 }, uSeed: { value: Math.random() } }; m.scale.setScalar(0.5); const a = rnd(0, 6.28, k + 40), rr = rnd(0.6, 2.6, k + 50); m.position.set(base.x + Math.cos(a) rr 1.25, base.y + Math.sin(a) rr, 0.03 + k 0.006); m.rotation.z = rnd(-1.4, 1.4, k + 60) + (k % 3 === 0 ? Math.PI : 0); const ms = new THREE.Mesh(sh.geometry, sh.material.clone()); ms.scale.setScalar(0.5); ms.position.set(m.position.x + 0.05, m.position.y - 0.07, 0.012); ms.rotation.z = m.rotation.z; ms.material.opacity = .35; scene.add(ms); scene.add(m); extras.push(m); } } posters.push({ p, mesh, mat, sh, base, extras, mode: 'street', lift: 0, hover: 0 }); }); const chalk = new THREE.Mesh(posterGeo, new THREE.MeshBasicMaterial({ map: null, transparent: true, depthWrite: false, opacity: 0 })); chalk.position.set(0.2, N SEG, 0.012); chalk.rotation.z = -0.05; scene.add(chalk);

/ dimmer for the picked-up view / const dimMat = new THREE.MeshBasicMaterial({ color: 0x000000, transparent: true, opacity: 0, depthWrite: false }); const dim = new THREE.Mesh(new THREE.PlaneGeometry(200, 200), dimMat); dim.position.z = 0.9; scene.add(dim);

/ ================================================================ LAYOUT / SCROLL ================================================================ / let step = 600; function layout() { const w = innerWidth, h = innerHeight, a = w / h; renderer.setSize(w, h, false); shared.uRes.value.set(w renderer.getPixelRatio(), h renderer.getPixelRatio()); camera.aspect = a; camera.fov = a < 0.8 ? 40 : 32; camera.updateProjectionMatrix(); const tan = Math.tan(THREE.MathUtils.degToRad(camera.fov / 2)); CAM_Z = a < 0.8 ? (PW / 0.62) / (2 tan a) : (PH / 0.6) / (2 tan); step = Math.max(420, h 0.7); document.getElementById('space').style.height = (h + step N) + 'px'; } const state = { p: 0, pt: 0, open: false, active: -1, hovered: -1, ready: false, idx: -1, time: 0, mx: 0, my: 0, smx: 0, smy: 0, intro: 1, end: 0 }; let snapT; addEventListener('scroll', () => { if (state.open) return; state.pt = THREE.MathUtils.clamp(scrollY / step, 0, N); clearTimeout(snapT); snapT = setTimeout(() => { if (!state.open) { const t = Math.round(state.pt) step; if (Math.abs(scrollY - t) > 2) scrollTo({ top: t, behavior: 'smooth' }); } }, 170); }, { passive: true }); addEventListener('resize', () => { layout(); });

/ ================================================================ UI ================================================================ / const $ = id => document.getElementById(id); const root = document.documentElement; $('ticks').innerHTML = P.map((p, i) => <button data-i="${i}" aria-label="${p.name}"><span>${p.name}</span><i></i></button>).join(''); const tickBtns = [...$('ticks').children]; $('index').innerHTML = P.map((p, i) => <button data-i="${i}"><span class="n">${pad2(i + 1)}</span><i class="d" style="background:${p.dot}"></i><span class="b">${p.name}</span><span class="c">${p.kind}</span><span class="y">${p.year}</span></button>).join(''); const idxBtns = [...$('index').children]; function goTo(i) { toggleIndex(false); toggleContact(false); scrollTo({ top: i * step, behavior: 'smooth' }); } $('ticks').addEventListener('click', e => { const b = e.target.closest('button'); if (b) goTo(+b.dataset.i); }); $('index').addEventListener('click', e => { const b = e.target.closest('button'); if (b) goTo(+b.dataset.i); }); function toggleIndex(f) { const on = f ?? !document.body.classList.contains('index-open'); document.body.classList.toggle('index-open', on); if (on) document.body.classList.remove('contact-open'); } function toggleContact(f) { const on = f ?? !document.body.classList.contains('contact-open'); document.body.classList.toggle('contact-open', on); if (on) document.body.classList.remove('index-open'); } $('indexBtn').addEventListener('click', e => { e.stopPropagation(); toggleIndex(); }); $('contactBtn').addEventListener('click', e => { e.stopPropagation(); toggleContact(); }); canvas.addEventListener('pointerdown', () => { toggleIndex(false); toggleContact(false); }); $('copy').addEventListener('click', () => { navigator.clipboard?.writeText('hello@gullypress.in'); }); $('restart').addEventListener('click', () => scrollTo({ top: 0, behavior: 'smooth' })); addEventListener('keydown', e => { if (state.open) { if (e.key === 'Escape') closeCase(); if (e.key === 'ArrowRight') switchCase(1); return; } if (e.key === 'Escape') { toggleIndex(false); toggleContact(false); } }); const MOON = '<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/>', SUN = '<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/>'; $('theme').addEventListener('click', () => { const day = root.dataset.theme !== 'day'; root.dataset.theme = day ? 'day' : 'night'; $('ico').innerHTML = day ? SUN : MOON; gsap.to(shared.uDay, { value: day ? 1 : 0, duration: 1.2, ease: 'power2.inOut' }); renderer.setClearColor(day ? 0xd9d4cb : 0x0b0a09, 1); });

function setHero(i, instant) { const p = P[i]; root.style.setProperty('--active', p.dot); tickBtns.forEach((b, k) => b.classList.toggle('on', k === i)); idxBtns.forEach((b, k) => b.classList.toggle('cur', k === i)); const meta = ${p.kind} · ${p.client} · ${p.year}; const wheel = $('wheel'), old = wheel.lastElementChild, nu = document.createElement('span'); nu.textContent = pad2(i + 1); if (instant) { wheel.innerHTML = ''; wheel.appendChild(nu); $('title').textContent = p.name; $('meta').textContent = meta; return; } const dir = i > state.idx ? 1 : -1; nu.style.position = 'absolute'; nu.style.left = 0; nu.style.top = 0; wheel.appendChild(nu); gsap.fromTo(nu, { yPercent: 100 dir }, { yPercent: 0, duration: .6, ease: 'expo.out' }); gsap.to(old, { yPercent: -100 dir, duration: .6, ease: 'expo.out', onComplete: () => { old.remove(); nu.style.position = ''; } }); const t = $('title'); gsap.killTweensOf(t); gsap.to(t, { opacity: .2, filter: 'blur(10px)', y: -8, duration: .18, ease: 'power2.in', onComplete: () => { t.textContent = p.name; $('meta').textContent = meta; gsap.fromTo(t, { opacity: .2, filter: 'blur(12px)', y: 10 }, { opacity: 1, filter: 'blur(0px)', y: 0, duration: .6, ease: 'expo.out' }); } }); }

/ ================================================================ HOVER + PICK UP ================================================================ / const ray = new THREE.Raycaster(), ndc = new THREE.Vector2(); let cx = -999, cy = -999; const hpill = $('hpill'); addEventListener('pointermove', e => { cx = e.clientX; cy = e.clientY; state.mx = cx / innerWidth 2 - 1; state.my = -(cy / innerHeight) 2 + 1; hpill.style.left = cx + 'px'; hpill.style.top = cy + 'px'; }); function pick(x, y) { ndc.set(x / innerWidth 2 - 1, -(y / innerHeight) 2 + 1); ray.setFromCamera(ndc, camera); const list = posters.filter(o => o.mode === 'street' && o.mat.uniforms.uOpacity.value > .5).map(o => o.mesh); const hit = ray.intersectObjects(list)[0]; return hit ? hit.object.userData.i : -1; } canvas.addEventListener('click', e => { if (!state.ready || state.open || state.end > .5) return; const i = pick(e.clientX, e.clientY); if (i > -1) openCase(i); });

const caseEl = $('case'); function fillCase(i) { const p = P[i]; root.style.setProperty('--active', p.dot); $('ck').textContent = ${p.kind} · ${p.year}; $('cb').textContent = p.name; $('cc').textContent = For ${p.client}; $('cd').textContent = p.desc; $('cr').innerHTML = [['Format', p.format], ['Print', p.print], ['Run', p.run], ['Paper', p.paper]].map(([a, b]) => <div><span>${a}</span><span>${b}</span></div>).join(''); $('nextn').textContent = P[(i + 1) % N].name; } function targetPose() { const r = $('media').getBoundingClientRect(); const Z = 6.5, dist = CAM_Z - Z; const vh = 2 dist Math.tan(THREE.MathUtils.degToRad(camera.fov / 2)), vw = vh camera.aspect; let w = r.width, h = r.height; if (w / h > PW / PH) w = h PW / PH; else h = w PH / PW; const s = (h / innerHeight) vh / PH; const nx = ((r.left + r.width / 2) / innerWidth) 2 - 1, ny = -((r.top + r.height / 2) / innerHeight) 2 + 1; return { x: camera.position.x + nx vw / 2, y: camera.position.y + ny vh / 2, z: Z, s }; } function openCase(i) { state.open = true; state.active = i; clearTimeout(snapT); hpill.classList.remove('on'); state.hovered = -1; canvas.style.cursor = ''; fillCase(i); document.body.classList.add('case-open'); root.classList.add('locked'); caseEl.setAttribute('aria-hidden', 'false'); const o = posters[i]; o.mode = 'case'; o.from = { x: o.mesh.position.x, y: o.mesh.position.y, z: o.mesh.position.z, r: o.mesh.rotation.z, s: o.mesh.scale.x }; o.t = 0; gsap.to(o, { t: 1, duration: reduced ? .01 : 1.15, ease: 'expo.inOut' }); gsap.timeline().to(o.mat.uniforms.uCurl, { value: .55, duration: .45, ease: 'power2.out' }).to(o.mat.uniforms.uCurl, { value: 0, duration: .7, ease: 'power3.inOut' }); gsap.to(o.mat.uniforms.uFlat, { value: 1, duration: 1 }); gsap.to(dimMat, { opacity: .55, duration: .9 }); setTimeout(() => caseEl.classList.add('show'), 480); } function closeCase() { if (!state.open) return; const i = state.active, o = posters[i]; caseEl.classList.remove('show'); document.body.classList.remove('case-open'); caseEl.setAttribute('aria-hidden', 'true'); o.mode = 'back'; o.from = { x: o.mesh.position.x, y: o.mesh.position.y, z: o.mesh.position.z, r: o.mesh.rotation.z, s: o.mesh.scale.x }; o.t = 0; gsap.to(o, { t: 1, duration: reduced ? .01 : 1.05, ease: 'expo.inOut', onComplete: () => { o.mode = 'street'; } }); gsap.timeline().to(o.mat.uniforms.uCurl, { value: .45, duration: .4 }).to(o.mat.uniforms.uCurl, { value: 0, duration: .65, ease: 'power3.inOut' }); gsap.to(o.mat.uniforms.uFlat, { value: 0, duration: .9 }); gsap.to(dimMat, { opacity: 0, duration: .8 }); root.classList.remove('locked'); scrollTo(0, i * step); state.pt = i; state.open = false; state.active = -1; } function switchCase(dir) { if (!state.open) return; const ni = (state.active + dir + N) % N; closeCase(); setTimeout(() => openCase(ni), 950); } $('close').addEventListener('click', closeCase); $('nextp').addEventListener('click', () => switchCase(1));

/ ================================================================ LOOP ================================================================ / const clock = new THREE.Clock(); function easeIO(x) { x = Math.min(1, Math.max(0, x)); return x x (3 - 2 x); } function streetPose(o, i, out) { const d = state.p - i; // >0: walked past it, <0: still ahead let x = o.base.x, y = o.base.y, z = 0.03, r = o.base.r, s = o.p.pile ? 0.5 : 1, lift = 0, curl = 0, op = 1, wave = 0; if (d > 0) { // the wind takes it const k = easeIO(d / 1.0); lift = k 2.6; y += d SEG 1.22; x += k 1.4; r += k 0.8; curl = Math.sin(Math.min(d, 1) Math.PI) 0.65 + k 0.2; op = 1 - easeIO((d - 0.3) / 0.5); wave = k; } else if (d > -1.3) { // it is still settling const k = easeIO((-d) / 1.3); lift = k 1.8; r += k 0.45; x -= k 0.5; y += k 0.6; curl = k 0.3; wave = k; } if (state.intro > 0 && i < 2) { lift += state.intro 3.5; curl += state.intro 0.4; r += state.intro 0.6; } out.x = x; out.y = y; out.z = z + lift; out.r = r; out.s = s; out.lift = lift; out.curl = curl; out.op = op; out.wave = wave; return out; } const pose = {}; function tick() { const dt = Math.min(clock.getDelta(), .05); state.time += dt; shared.uTime.value = state.time; state.p += (state.pt - state.p) (1 - Math.exp(-dt 4)); if (!state.open) { state.smx += (state.mx - state.smx) .04; state.smy += (state.my - state.smy) * .04; } state.end = THREE.MathUtils.smoothstep(state.p, N - 1, N); document.body.classList.toggle('at-end', state.end > .55 && !state.open);

camera.position.set(state.smx 0.25, state.p SEG + state.smy 0.2 - 0.5, CAM_Z + state.intro 6); camera.rotation.set(state.smy 0.015, -state.smx 0.02, 0); dim.position.set(camera.position.x, camera.position.y, 0.9);

const ai = THREE.MathUtils.clamp(Math.round(Math.min(state.p, N - 1)), 0, N - 1); if (ai !== state.idx && state.ready && !state.open) { setHero(ai, state.idx < 0); state.idx = ai; }

if (!isTouch && state.ready && !state.open && state.end < .5) { const h = pick(cx, cy); if (h !== state.hovered) { state.hovered = h; if (h > -1) { $('hname').textContent = P[h].name; hpill.classList.add('on'); canvas.style.cursor = 'pointer'; } else { hpill.classList.remove('on'); canvas.style.cursor = ''; } } }

posters.forEach((o, i) => { const u = o.mat.uniforms; o.hover += ((state.hovered === i ? 1 : 0) - o.hover) .12; u.uHover.value = o.hover; streetPose(o, i, pose); pose.z += o.hover 0.35; pose.curl += o.hover 0.12; if (o.mode === 'street') { o.mesh.position.set(pose.x, pose.y, pose.z); o.mesh.rotation.z = pose.r; o.mesh.scale.setScalar(pose.s); u.uCurl.value = pose.curl; u.uWave.value = pose.wave; u.uOpacity.value = pose.op; } else { const T = o.mode === 'case' ? targetPose() : { x: pose.x, y: pose.y, z: pose.z, s: pose.s }; const k = o.mode === 'case' ? o.t : o.t, A = o.mode === 'case' ? o.from : o.from, B = T; o.mesh.position.set(THREE.MathUtils.lerp(A.x, B.x, k), THREE.MathUtils.lerp(A.y, B.y, k), THREE.MathUtils.lerp(A.z, B.z, k) + Math.sin(k Math.PI) 1.2); o.mesh.rotation.z = THREE.MathUtils.lerp(A.r, o.mode === 'case' ? 0 : pose.r, k); o.mesh.scale.setScalar(THREE.MathUtils.lerp(A.s, B.s, k)); u.uOpacity.value = 1; u.uWave.value = 0; } // shadow: offset grows with height, softer and lighter const L = Math.max(0, o.mesh.position.z - 0.03); o.sh.position.set(o.mesh.position.x + 0.05 + L 0.32, o.mesh.position.y - 0.08 - L 0.5, 0.012); o.sh.rotation.z = o.mesh.rotation.z; o.sh.scale.setScalar(o.mesh.scale.x (0.86 + L 0.06)); o.sh.material.opacity = Math.max(0, (0.55 - L 0.045)) u.uOpacity.value (o.mode === 'street' ? 1 : 0.8) (1 - shared.uDay.value .25); }); chalk.material.opacity = 0.75 THREE.MathUtils.smoothstep(state.p, N - 0.6, N) (1 - shared.uDay.value * .4);

renderer.render(scene, camera); requestAnimationFrame(tick); }

/ ================================================================ BOOT ================================================================ / async function boot() { layout(); try { await Promise.race([Promise.all(['700 80px "Familjen Grotesk"', '80px "Instrument Serif"', '80px Anton', '30px "DM Mono"', '500 80px Caveat'].map(f => document.fonts.load(f))), new Promise(r => setTimeout(r, 3000))]); } catch (e) {} await Promise.all(Object.entries(PHOTOS).map(([k, src]) => new Promise(res => { const im = new Image(); im.crossOrigin = 'anonymous'; im.onload = () => { photoImgs[k] = im; res(); }; im.onerror = () => res(); im.src = src; }))); posters.forEach(o => { const t = makePoster(o.p); o.mat.uniforms.uTex.value = t; o.extras.forEach(m => m.material.uniforms.uTex = { value: t }); }); chalk.material.map = chalkTex(); chalk.material.needsUpdate = true; state.p = state.pt = THREE.MathUtils.clamp(scrollY / step, 0, N); requestAnimationFrame(tick); $('loader').classList.add('done'); state.ready = true; gsap.to(state, { intro: 0, duration: reduced ? .01 : 2.6, ease: 'expo.out' }); setTimeout(() => document.body.classList.add('ready'), 600); } boot(); </script> </body> </html>

Source, 788 lines
<!DOCTYPE html>
<html lang="en" data-theme="night">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#0b0a09" />
<title>Gully Press — Posters & printed matter</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Familjen+Grotesk:wght@400..700&family=Instrument+Serif:ital@0;1&family=Anton&family=DM+Mono&family=Caveat:wght@500&display=swap" rel="stylesheet" />
<style>
  :root{--font:"Familjen Grotesk",system-ui,-apple-system,"Segoe UI",sans-serif;--ease:cubic-bezier(.16,1,.3,1);--pad:clamp(18px,3vw,38px);--active:#e8e1d3}
  html[data-theme="night"]{--bg:#0b0a09;--fg:#f1ece4;--mute:rgba(241,236,228,.55);--soft:rgba(241,236,228,.3);--line:rgba(241,236,228,.12);--pill:rgba(22,20,18,.7);--pillb:rgba(255,255,255,.1);--panel:rgba(16,15,13,.88);--chip:#f1ece4;--chipink:#111}
  html[data-theme="day"]{--bg:#d9d4cb;--fg:#141210;--mute:rgba(20,18,16,.6);--soft:rgba(20,18,16,.3);--line:rgba(20,18,16,.12);--pill:rgba(255,255,255,.62);--pillb:rgba(0,0,0,.08);--panel:rgba(245,242,236,.92);--chip:#141210;--chipink:#f1ece4}
  *{box-sizing:border-box;margin:0;padding:0}
  html,body{background:var(--bg);color:var(--fg);transition:background .8s,color .8s}
  body{font-family:var(--font);-webkit-font-smoothing:antialiased;overflow-x:hidden;overscroll-behavior-y:none}
  button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
  a{color:inherit;text-decoration:none}
  html.locked,html.locked body{overflow:hidden}
  #gl{position:fixed;inset:0;width:100%;height:100%;display:block;z-index:0;touch-action:pan-y}
  #space{position:relative;z-index:-1}
  .grain{position:fixed;inset:-50%;z-index:2;pointer-events:none;opacity:.08;mix-blend-mode:overlay;
    background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");animation:grain 1s steps(6) infinite}
  @keyframes grain{0%{transform:translate(0,0)}25%{transform:translate(-3%,2%)}50%{transform:translate(2%,-3%)}75%{transform:translate(-2%,-1%)}100%{transform:translate(0,0)}}

  #loader{position:fixed;inset:0;z-index:100;background:#0b0a09;display:grid;place-items:center;transition:opacity 1.1s var(--ease),visibility 1.1s}
  #loader.done{opacity:0;visibility:hidden}
  #loader span{width:56px;height:78px;border:1.5px solid rgba(241,236,228,.5);border-radius:2px;animation:lp 1.4s infinite var(--ease)}
  @keyframes lp{50%{transform:rotate(8deg) translateY(-6px);opacity:.5}}

  /* top bar */
  .top{position:fixed;top:0;left:0;right:0;z-index:30;display:flex;justify-content:space-between;align-items:flex-start;padding:var(--pad);pointer-events:none}
  .top>*{pointer-events:auto}
  .logo b{display:block;font-weight:700;font-size:clamp(22px,2vw,27px);letter-spacing:-.035em;line-height:1}
  .logo small{display:block;margin-top:7px;font-size:clamp(12px,1vw,14px);color:var(--mute)}
  .acts{display:flex;gap:8px;transition:opacity .5s var(--ease),transform .5s var(--ease)}
  .btn{height:38px;padding:0 16px;border-radius:999px;background:var(--pill);border:1px solid var(--pillb);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);font-size:15px;font-weight:600;letter-spacing:-.02em;display:inline-flex;align-items:center;gap:4px;transition:transform .3s var(--ease)}
  .btn:hover{transform:translateY(-1px)}
  .btn sup{font-size:10px;opacity:.6;margin-top:-10px}
  .btn.round{width:38px;padding:0;justify-content:center}
  .btn svg{width:16px;height:16px}
  .close{position:fixed;top:var(--pad);right:var(--pad);z-index:31;width:42px;height:42px;opacity:0;transform:scale(.8) rotate(-45deg);pointer-events:none;transition:opacity .5s var(--ease),transform .6s var(--ease)}
  .case-open .close{opacity:1;transform:none;pointer-events:auto;transition-delay:.3s}
  .case-open .acts{opacity:0;transform:translateY(-8px);pointer-events:none}

  /* contact */
  .contact{position:fixed;z-index:29;top:calc(var(--pad) + 48px);right:var(--pad);width:min(330px,calc(100vw - 2*var(--pad)));padding:20px 18px 16px;border-radius:18px;background:var(--panel);border:1px solid var(--line);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);opacity:0;transform:translateY(-8px) scale(.97);transform-origin:top right;pointer-events:none;transition:opacity .4s var(--ease),transform .5s var(--ease)}
  .contact-open .contact{opacity:1;transform:none;pointer-events:auto}
  .contact p{font-size:15px;line-height:1.42;color:color-mix(in srgb,var(--fg) 82%,transparent)}
  .mail{margin-top:16px;display:flex;align-items:center;justify-content:space-between;height:46px;padding:0 10px 0 16px;border-radius:999px;border:1px solid var(--line);font-weight:600;font-size:15px}
  .mail button{width:30px;height:30px;border-radius:8px;display:grid;place-items:center}
  .mail button svg{width:15px;height:15px}
  .socials{margin-top:14px;display:flex;gap:16px;font-size:13px;color:var(--mute)}

  /* hero copy */
  .hero{position:fixed;left:var(--pad);bottom:calc(var(--pad) + 4px);z-index:20;pointer-events:none;max-width:calc(100vw - 2*var(--pad));transition:opacity .6s var(--ease),transform .7s var(--ease)}
  .index-open .hero,.case-open .hero,.at-end .hero{opacity:0;transform:translateX(-24px)}
  body:not(.ready) .hero,body:not(.ready) .ticks{opacity:0}
  .count{display:flex;align-items:center;gap:6px;font-size:13px;font-weight:700;margin-bottom:4px}
  .count .wheel{display:inline-block;height:1.15em;overflow:hidden;position:relative;min-width:1.4em}
  .count .wheel span{display:block;line-height:1.15em}
  .count em{font-style:normal;color:var(--mute);font-weight:500}
  .title{font-weight:700;font-size:clamp(50px,7vw,100px);letter-spacing:-.05em;line-height:1.02;white-space:nowrap}
  .meta{margin-top:8px;display:flex;align-items:center;gap:10px;font-size:clamp(13px,1.15vw,16px);font-weight:600;color:color-mix(in srgb,var(--fg) 86%,transparent)}
  .meta i{width:11px;height:11px;border-radius:2px;background:var(--active);box-shadow:0 0 0 1px rgba(255,255,255,.18);transition:background .6s}
  .hint{margin-top:24px;display:flex;align-items:center;gap:12px;font-size:13px;color:var(--mute)}
  .hint::before{content:"";width:1px;height:18px;background:var(--soft)}

  /* right index ticks */
  .ticks{position:fixed;right:var(--pad);top:50%;transform:translateY(-50%);z-index:20;display:flex;flex-direction:column;align-items:flex-end;gap:2px;transition:opacity .5s}
  .case-open .ticks,.at-end .ticks{opacity:0;pointer-events:none}
  .ticks button{display:flex;align-items:center;gap:10px;height:22px;font-size:13px;font-weight:600;letter-spacing:-.01em}
  .ticks button span{opacity:0;transform:translateX(6px);transition:opacity .35s,transform .45s var(--ease);color:var(--mute);white-space:nowrap}
  .ticks button i{width:14px;height:1.5px;background:var(--soft);transition:width .45s var(--ease),background .45s}
  .ticks button.on span{opacity:1;transform:none;color:var(--fg)}
  .ticks button.on i{width:34px;background:var(--fg)}
  .ticks:hover button span{opacity:1;transform:none}
  .ticks button:hover i{background:var(--fg)}

  /* hover pill */
  .hpill{position:fixed;left:0;top:0;z-index:40;pointer-events:none;display:flex;align-items:center;gap:8px;padding:8px 14px;border-radius:999px;background:var(--chip);color:var(--chipink);font-size:14px;font-weight:700;white-space:nowrap;opacity:0;transform:translate(14px,-50%) scale(.85);transform-origin:left center;transition:opacity .25s,transform .35s var(--ease)}
  .hpill.on{opacity:1;transform:translate(18px,-50%) scale(1)}
  .hpill span{font-weight:500;opacity:.55}
  @media (hover:none){.hpill{display:none}}

  /* index panel */
  .index{position:fixed;z-index:25;left:var(--pad);top:calc(var(--pad) + 62px);bottom:calc(var(--pad) + 4px);width:min(470px,calc(100vw - 2*var(--pad)));background:var(--panel);border:1px solid var(--line);border-radius:16px;backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);padding:6px 20px;overflow:auto;opacity:0;transform:translateX(-20px);pointer-events:none;transition:opacity .5s var(--ease),transform .6s var(--ease)}
  .index-open .index{opacity:1;transform:none;pointer-events:auto}
  .index button{width:100%;display:grid;grid-template-columns:30px 14px auto 1fr auto;align-items:center;gap:8px;padding:13px 0;border-bottom:1px solid var(--line);text-align:left;font-size:14px}
  .index button:last-child{border-bottom:0}
  .index .n{font-size:12px;color:var(--mute)}
  .index .d{width:10px;height:10px;border-radius:50%;box-shadow:0 0 0 1px rgba(255,255,255,.2)}
  .index .b{font-weight:700;font-size:16px;letter-spacing:-.02em;color:var(--mute)}
  .index .c{color:var(--mute);opacity:.75;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .index .y{font-size:12px;color:var(--mute)}
  .index button:hover .b,.index button.cur .b{color:var(--fg)}

  /* case */
  .case{position:fixed;inset:0;z-index:22;pointer-events:none;display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:clamp(24px,4vw,56px);padding:calc(var(--pad) + 60px) var(--pad) var(--pad);align-items:center}
  .case-open .case{pointer-events:auto}
  .media{height:min(74vh,640px)}
  .panel{max-width:430px;width:100%}
  .panel>*{opacity:0;transform:translateY(18px);transition:opacity .6s var(--ease),transform .8s var(--ease)}
  .case.show .panel>*{opacity:1;transform:none}
  .case.show .panel>*:nth-child(2){transition-delay:.05s}.case.show .panel>*:nth-child(3){transition-delay:.1s}.case.show .panel>*:nth-child(4){transition-delay:.15s}.case.show .panel>*:nth-child(5){transition-delay:.2s}.case.show .panel>*:nth-child(6){transition-delay:.25s}
  .case.swap .panel>*{opacity:0!important;transform:translateY(-10px)!important;transition-delay:0s!important;transition-duration:.25s!important}
  .k{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:600;color:var(--mute)}
  .k i{width:8px;height:8px;border-radius:50%;background:var(--active)}
  .panel h2{margin-top:10px;font-weight:700;font-size:clamp(40px,4.4vw,62px);letter-spacing:-.05em;line-height:1}
  .panel h3{margin-top:10px;font-weight:700;font-size:clamp(17px,1.4vw,20px);letter-spacing:-.02em}
  .panel p{margin-top:16px;font-size:clamp(14px,1.15vw,16px);line-height:1.5;color:var(--fg);color:color-mix(in srgb,var(--fg) 75%,transparent);max-width:38ch}
  .rows{margin-top:22px}
  .rows div{display:flex;justify-content:space-between;gap:16px;padding:11px 0;border-top:1px solid var(--line);font-size:14px}
  .rows div span:first-child{color:var(--mute)}
  .rows div span:last-child{font-weight:700;text-align:right}
  .cta{margin-top:22px;display:flex;justify-content:space-between;align-items:center;gap:12px}
  .full{height:46px;padding:0 22px;border-radius:999px;background:var(--fg);color:var(--bg);font-size:15px;font-weight:700;display:inline-flex;align-items:center;gap:10px;transition:transform .3s var(--ease)}
  .full:hover{transform:scale(1.04)}
  .nextp{text-align:right;font-size:13px;color:var(--mute)}
  .nextp b{display:block;color:var(--fg);font-size:14px}

  /* outro */
  .outro{position:fixed;left:var(--pad);bottom:calc(var(--pad) + 4px);z-index:20;pointer-events:none;opacity:0;transform:translateY(30px);transition:opacity .8s var(--ease),transform 1s var(--ease)}
  .at-end .outro{opacity:1;transform:none;pointer-events:auto}
  .outro h2{font-weight:700;font-size:clamp(50px,7vw,100px);letter-spacing:-.05em;line-height:1.02}
  .outro h2 em{font-style:normal;color:var(--mute)}
  .outro .meta{color:color-mix(in srgb,var(--fg) 75%,transparent)}
  .outro .go{margin-top:20px;display:flex;flex-wrap:wrap;gap:10px}
  .outro .full{height:50px}

  @media (max-width:860px){
    .case{grid-template-columns:1fr;grid-template-rows:auto 1fr;align-items:start;gap:16px;padding-top:calc(var(--pad) + 62px);overflow:hidden}
    .media{height:36vh}
    .panel{max-width:none;overflow:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;height:100%;padding-bottom:20px}
    .ticks button span{display:none}
    .ticks button.on i{width:22px}
  }
  @media (max-width:560px){
    .logo small{max-width:160px}
    .btn{height:34px;padding:0 12px;font-size:14px}.btn.round{width:34px}
    .title,.outro h2{font-size:clamp(40px,12.5vw,58px)}
    .hero,.outro{bottom:calc(var(--pad) + 6px)}
    .hint{margin-top:14px}
    .index .c{display:none}.index button{grid-template-columns:28px 14px 1fr auto}
    .ticks{right:12px}
  }
  @media (prefers-reduced-motion:reduce){.grain{animation:none}}
</style>
</head>
<body>
<div id="loader"><span></span></div>
<canvas id="gl" aria-label="Posters lying on a street at night"></canvas>
<div class="grain"></div>
<div id="space"></div>

<header class="top">
  <a href="#" class="logo"><b>Gully Press</b><small>Posters & printed matter, Vizag</small></a>
  <div class="acts">
    <button class="btn round" id="theme" aria-label="Switch day or night"><svg id="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg></button>
    <button class="btn" id="indexBtn">Index<sup>10</sup></button>
    <button class="btn" id="contactBtn">Contact</button>
  </div>
</header>
<button class="btn round close" id="close" aria-label="Put the poster down"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>

<div class="contact" id="contact" role="dialog" aria-label="Contact">
  <p>A two-person print studio near the beach road. We design and print posters for libraries, galleries, festivals and the odd chai shop: riso, screen, offset and letterpress.</p>
  <div class="mail"><a href="mailto:hello@gullypress.in">hello@gullypress.in</a><button id="copy" aria-label="Copy email"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V6a2 2 0 0 1 2-2h9"/></svg></button></div>
  <div class="socials"><a href="#">Instagram</a><a href="#">Are.na</a><a href="#">Shop</a></div>
</div>
<nav class="index" id="index" aria-label="Poster index"></nav>

<section class="hero" id="hero">
  <div class="count"><span class="wheel" id="wheel"><span>01</span></span><em>/ 10</em></div>
  <h1 class="title" id="title">Poster</h1>
  <div class="meta"><i></i><span id="meta"></span></div>
  <div class="hint" id="hint">Scroll to walk the street · click a poster to pick it up</div>
</section>
<nav class="ticks" id="ticks" aria-label="Posters"></nav>
<div class="hpill" id="hpill"><b id="hname"></b><span>Pick up</span></div>

<section class="case" id="case" aria-hidden="true">
  <div class="media" id="media"></div>
  <div class="panel">
    <div class="k"><i></i><span id="ck"></span></div>
    <h2 id="cb"></h2>
    <h3 id="cc"></h3>
    <p id="cd"></p>
    <div class="rows" id="cr"></div>
    <div class="cta"><a class="full" href="mailto:hello@gullypress.in">Request a print <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M5 12h14M13 6l6 6-6 6"/></svg></a><button class="nextp" id="nextp">Next poster<b id="nextn"></b></button></div>
  </div>
</section>

<section class="outro" id="outro">
  <div class="count"><span>End</span><em>/ 10 posters</em></div>
  <h2>Start a project<em>.</em></h2>
  <div class="meta"><span><b>Your poster could be next.</b> · Booking spring 2027 · Riso to letterpress</span></div>
  <div class="go"><a class="full" href="mailto:hello@gullypress.in">Commission a poster <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M5 12h14M13 6l6 6-6 6"/></svg></a><button class="btn" id="restart" style="height:50px;padding:0 20px">Back to 01</button></div>
</section>

<script type="importmap">
{ "imports": { "three": "https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js", "gsap": "https://cdn.jsdelivr.net/npm/gsap@3.12.5/+esm" } }
</script>
<script type="module">
import * as THREE from 'three';
import { gsap } from 'gsap';

/* ================================================================
   PHOTOS used inside some posters (free Unsplash photos).
   Swap any URL for your own (it needs CORS) or a local path.
   ================================================================ */
const PHOTOS = {
  sea: 'https://images.unsplash.com/photo-1510279770292-4b34de9f5c23?auto=format&fit=crop&w=800&h=800&q=75',
  night: 'https://images.unsplash.com/photo-1498036882173-b41c28a8ba34?auto=format&fit=crop&w=800&h=800&q=75',
  dance: 'https://images.unsplash.com/photo-1485889397316-8393dd065127?auto=format&fit=crop&w=800&h=800&q=75',
  rose: 'https://images.unsplash.com/photo-1500412830877-c77d92c33203?auto=format&fit=crop&w=800&h=800&q=75',
  bulbs: 'https://images.unsplash.com/photo-1473308822086-710304d7d30c?auto=format&fit=crop&w=800&h=800&q=75',
  road: 'https://images.unsplash.com/photo-1476820865390-c52aeebb9891?auto=format&fit=crop&w=800&h=800&q=75',
  stone: 'https://images.unsplash.com/photo-1443890923422-7819ed4101c0?auto=format&fit=crop&w=800&h=800&q=75'
};

/* ================================================================
   POSTERS — copy, print specs, ground under each one.
   ground: slabs | asphalt | zebra | tiles | road     leaf: dappled shade
   ================================================================ */
const P = [
  { name:'Quiet Hours',      kind:'Reading series',        client:'City Library',        year:2026, dot:'#1f1d1b', ground:'slabs',   leaf:0, design:'quiet',  format:'A2', print:'Offset, two colours', run:'400', paper:'Uncoated 170 g', desc:'Readings after closing time, every Thursday in July. Big quiet type, a long list of names, and enough empty paper to feel like a library at night.' },
  { name:'Salt & Sea',       kind:'Exhibition',            client:'Gallery Rushikonda',  year:2025, dot:'#e5392b', ground:'slabs',   leaf:0, design:'salt',   format:'50 × 70', print:'Riso, red only', run:'250', paper:'Munken 120 g', desc:'One red ink, one beach and two dates. The photo is printed as a single riso layer so the sea goes slightly pink at the edges.' },
  { name:'Night Bus',        kind:'Self-initiated, no. 88', client:'Daily Poster',       year:2026, dot:'#3d5b49', ground:'slabs',   leaf:0, design:'bus',    format:'A3', print:'Screen, three colours', run:'60', paper:'Colorplan 270 g', desc:'From a series of posters made in one evening each. This one is about the last bus home, the 28, and the city lights going past.' },
  { name:'Fold',             kind:'Poster series, no. 2',  client:'Fold Paper Co.',      year:2024, dot:'#efe6d2', ground:'asphalt', leaf:1, design:'fold',   format:'A2', print:'Letterpress, one colour', run:'300', paper:'Cotton 300 g', desc:'A house poster for a shop that only sells paper. A monogram, a size and a promise, pressed deep enough into the cotton that you can feel it.' },
  { name:'Now Open',         kind:'Launch flyers',         client:'Chai & Vinyl',        year:2026, dot:'#f1e9d6', ground:'asphalt', leaf:1, design:'open',   format:'A6 flyer', print:'Riso, black', run:'2,000', paper:'Recycled 100 g', desc:'Two thousand flyers for a record shop that also makes chai. Handed out on the beach road and, as you can see, mostly dropped.', pile:true },
  { name:'Open Floor',       kind:'Dance festival',        client:'Kalabharathi',        year:2025, dot:'#ef5a24', ground:'zebra',   leaf:0, design:'floor',  format:'A1', print:'Offset, four colours', run:'1,200', paper:'Silk 150 g', desc:'A three-night dance festival. One orange circle, one dancer, and a programme you can read from across the road.' },
  { name:'Zine Fair',        kind:'Print fair',            client:'Small Press Vizag',   year:2025, dot:'#e6408a', ground:'zebra',   leaf:0, design:'zine',   format:'A3', print:'Riso, pink and blue', run:'500', paper:'Riso 90 g', desc:'A fair for small presses, so the poster had to be riso: a halftone rose in blue over fluorescent pink, slightly out of register on purpose.' },
  { name:'Under the Bridge', kind:'Open-air cinema',       client:'Cinema by the Bay',   year:2026, dot:'#e3b45c', ground:'tiles',   leaf:0, design:'cinema', format:'A2', print:'Offset, gold + black', run:'600', paper:'Black 250 g', desc:'Films under the old bridge every Saturday in March. Gold ink on black paper, so it looks best at exactly the time people read it.' },
  { name:'10K by Night',     kind:'Night run',             client:'Beach Road Runners',  year:2025, dot:'#f5c518', ground:'road',    leaf:0, design:'run',    format:'A2', print:'Screen, yellow + black', run:'350', paper:'Fluoro 135 g', desc:'A ten-kilometre run along the beach road after dark. Fluorescent yellow so it glows under the streetlights it was pasted next to.' },
  { name:'Soft Stone',       kind:'Exhibition',            client:'Visakha Museum',      year:2026, dot:'#b9b2a5', ground:'slabs',   leaf:0, design:'stone',  format:'60 × 80', print:'Offset, duotone', run:'800', paper:'Uncoated 200 g', desc:'Sculpture, slowly. A single photo, a lot of margin and a serif that takes its time, for an exhibition about stone and patience.' },
];
const N = P.length;
const pad2 = n => String(n).padStart(2, '0');
const GROUND_ID = { slabs:0, asphalt:1, zebra:2, tiles:3, road:4 };

/* ================================================================
   RENDERER
   ================================================================ */
const isTouch = matchMedia('(hover: none)').matches;
const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;
const canvas = document.getElementById('gl');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, powerPreference: 'high-performance' });
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.setClearColor(0x0b0a09, 1);
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(32, innerWidth / innerHeight, 0.1, 200);
scene.add(camera);

const SEG = 9;                       // street distance between posters
const PW = 3.0, PH = PW * 1.414;     // poster size (A-series)
let CAM_Z = 15.5;

/* ================================================================
   SHARED GLSL: noise + light (lamp pool, blinds, leaves, day/night)
   ================================================================ */
const GLSL_COMMON = `
  uniform float uTime, uDay; uniform vec2 uRes;
  float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
  float noise(vec2 p){ vec2 i = floor(p), f = fract(p); vec2 u = f*f*(3.0-2.0*f);
    return mix(mix(hash(i), hash(i+vec2(1,0)), u.x), mix(hash(i+vec2(0,1)), hash(i+vec2(1,1)), u.x), u.y); }
  float fbm(vec2 p){ float v = 0.0, a = 0.5; for (int i = 0; i < 5; i++){ v += a*noise(p); p = p*2.03 + 7.1; a *= 0.5; } return v; }
  vec3 lightAt(vec3 col, vec2 world, float leaf){
    vec2 uv = gl_FragCoord.xy / uRes;
    vec2 c = uv - vec2(0.54, 0.58); c.x *= uRes.x / uRes.y;
    float pool = exp(-dot(c, c) / 0.11);
    float blinds = smoothstep(0.26, 0.02, uv.x) * step(0.5, fract((uv.x * 0.8 + uv.y * 0.5) * 17.0));
    float dap = smoothstep(0.44, 0.6, fbm(world * 0.32 + vec2(uTime * 0.021, uTime * 0.013)));
    vec3 night = col * (vec3(0.045, 0.042, 0.045) + vec3(1.15, 0.88, 0.6) * pool * 1.25);
    night *= 1.0 - blinds * 0.6;
    night *= 1.0 - leaf * dap * 0.75;
    float vig = smoothstep(1.25, 0.35, length((uv - 0.5) * vec2(uRes.x / uRes.y, 1.0)));
    night *= mix(0.3, 1.0, vig);
    vec3 day = col * vec3(1.42, 1.36, 1.26) * (1.0 - dap * 0.5 * (0.45 + 0.55 * leaf)) * (1.0 - blinds * 0.32);
    return mix(night, day, uDay);
  }`;
const shared = { uTime: { value: 0 }, uDay: { value: 0 }, uRes: { value: new THREE.Vector2(1, 1) } };

/* ================================================================
   GROUND — one long procedural street, a different surface per poster
   ================================================================ */
const types = new Float32Array(16), leaves = new Float32Array(16);
for (let i = 0; i < 16; i++) { const p = P[Math.min(i, N - 1)]; types[i] = i >= N ? 0 : GROUND_ID[p.ground]; leaves[i] = i >= N ? 0 : p.leaf; }
const groundMat = new THREE.ShaderMaterial({
  uniforms: { ...shared, uSeg: { value: SEG }, uType: { value: types }, uLeaf: { value: leaves } },
  vertexShader: `varying vec2 vW; void main(){ vec4 w = modelMatrix * vec4(position, 1.0); vW = w.xy; gl_Position = projectionMatrix * viewMatrix * w; }`,
  fragmentShader: `
    ${GLSL_COMMON}
    uniform float uSeg; uniform float uType[16]; uniform float uLeaf[16];
    varying vec2 vW;
    vec3 slabs(vec2 p){
      vec3 c = vec3(0.47, 0.44, 0.40) * (0.9 + 0.12 * fbm(p * 1.3)) + (noise(p * 55.0) - 0.5) * 0.07;
      vec2 g = p / vec2(3.4, 3.4) + vec2(0.0, 0.5);
      vec2 f = abs(fract(g) - 0.5);
      float joint = smoothstep(0.488, 0.497, max(f.x, f.y));
      c *= 1.0 - joint * 0.55;
      float crack = smoothstep(0.006, 0.0, abs(fbm(p * vec2(0.9, 0.35) + 3.0) - 0.5 - 0.03 * sin(p.x * 3.0))) * step(0.78, hash(floor(g)));
      c *= 1.0 - crack * 0.45;
      return c;
    }
    vec3 asphalt(vec2 p){
      vec3 c = vec3(0.26, 0.25, 0.23) * (0.88 + 0.2 * fbm(p * 0.7));
      c += step(0.9, hash(floor(p * 70.0))) * 0.12 - step(0.92, hash(floor(p * 70.0) + 3.0)) * 0.08;
      return c + (noise(p * 120.0) - 0.5) * 0.05;
    }
    vec3 zebra(vec2 p, float cy){
      vec3 c = asphalt(p);
      float band = step(abs(p.y - cy), 3.4) * step(0.5, fract(p.x / 1.7));
      float worn = smoothstep(0.32, 0.5, fbm(p * 2.2));
      return mix(c, vec3(0.78, 0.76, 0.71) * (0.92 + 0.1 * noise(p * 30.0)), band * worn);
    }
    vec3 tiles(vec2 p){
      vec2 g = p / 0.85; vec2 id = floor(g); vec2 f = abs(fract(g) - 0.5);
      vec3 c = vec3(0.5, 0.48, 0.45) * (0.9 + 0.12 * hash(id)) + (noise(p * 60.0) - 0.5) * 0.05;
      return c * (1.0 - smoothstep(0.46, 0.49, max(f.x, f.y)) * 0.5);
    }
    vec3 road(vec2 p){
      vec3 c = asphalt(p) * 0.85;
      float lane = step(abs(p.x + 3.1), 0.09) * step(0.42, fract(p.y / 3.0));
      return mix(c, vec3(0.86, 0.74, 0.32), lane * smoothstep(0.3, 0.5, fbm(p * 3.0)));
    }
    vec3 surface(float t, vec2 p, float cy){
      vec3 c = vec3(0.0);
      if (t < 0.5) c = slabs(p);
      else if (t < 1.5) c = asphalt(p);
      else if (t < 2.5) c = zebra(p, cy);
      else if (t < 3.5) c = tiles(p);
      else c = road(p);
      return c;
    }
    void main(){
      float s = vW.y / uSeg;
      int i = int(clamp(floor(s + 0.5), 0.0, 15.0));
      float cy = float(i) * uSeg;
      vec3 c = surface(uType[i], vW, cy);
      // kerb between two surfaces
      float d = min(fract(s + 0.5), 1.0 - fract(s + 0.5)) * uSeg;
      if (i > 0 && uType[i] != uType[i - 1] || i < 15 && uType[i] != uType[min(i + 1, 15)]) {
        float k = smoothstep(0.32, 0.26, d);
        c = mix(c, vec3(0.55, 0.53, 0.5) * (0.9 + 0.1 * noise(vW * 20.0)), k);
        c *= 1.0 - smoothstep(0.035, 0.0, abs(d - 0.32)) * 0.5;
      }
      gl_FragColor = vec4(lightAt(c, vW, uLeaf[i]), 1.0);
      #include <colorspace_fragment>
    }`,
});
const ground = new THREE.Mesh(new THREE.PlaneGeometry(90, SEG * (N + 6)), groundMat);
ground.position.set(0, SEG * (N + 6) / 2 - SEG * 2.5, 0);
scene.add(ground);

/* ================================================================
   POSTER ART — painted on canvas (all original designs)
   ================================================================ */
const TW = 1024, TH = Math.round(1024 * 1.414);
const photoImgs = {};
function font(w, size, fam) { return `${w} ${size}px ${fam}`; }
const F = { grot: '"Familjen Grotesk", sans-serif', serif: '"Instrument Serif", Georgia, serif', anton: 'Anton, Impact, sans-serif', mono: '"DM Mono", monospace' };
function cover(g, img, x, y, w, h) {
  if (!img) { g.fillStyle = 'rgba(0,0,0,.25)'; g.fillRect(x, y, w, h); return; }
  const ir = img.width / img.height, r = w / h; let sw = img.width, sh = img.height, sx = 0, sy = 0;
  if (ir > r) { sw = sh * r; sx = (img.width - sw) / 2; } else { sh = sw / r; sy = (img.height - sh) / 2; }
  g.drawImage(img, sx, sy, sw, sh, x, y, w, h);
}
function tint(g, x, y, w, h, color, mode) { g.save(); g.globalCompositeOperation = mode || 'multiply'; g.fillStyle = color; g.fillRect(x, y, w, h); g.restore(); }
function grayscale(g, x, y, w, h) { const d = g.getImageData(x, y, w, h); for (let i = 0; i < d.data.length; i += 4) { const l = d.data[i] * .3 + d.data[i + 1] * .59 + d.data[i + 2] * .11; d.data[i] = d.data[i + 1] = d.data[i + 2] = l; } g.putImageData(d, x, y); }
function text(g, s, x, y, f, c, align) { g.font = f; g.fillStyle = c; g.textAlign = align || 'left'; g.fillText(s, x, y); }
function rule(g, x1, y1, x2, y2, c, w) { g.strokeStyle = c; g.lineWidth = w || 2; g.beginPath(); g.moveTo(x1, y1); g.lineTo(x2, y2); g.stroke(); }

const DESIGNS = {
  quiet(g) {
    g.fillStyle = '#e9dfca'; g.fillRect(0, 0, TW, TH);
    text(g, 'City Library', 70, 110, font(600, 30, F.grot), '#262320');
    text(g, 'Readings after dark', TW - 70, 140, font(400, 30, F.grot), '#262320', 'right');
    text(g, 'Quiet', 80, 470, font(400, 300, F.serif), '#1d1b19');
    text(g, 'Hours', 300, 700, font(400, 300, F.serif), '#1d1b19');
    g.fillStyle = '#1d1b19'; g.fillRect(84, 560, 26, 26); g.fillRect(120, 560, 26, 26);
    rule(g, 80, 820, TW - 80, 820, '#1d1b19', 2.5);
    ['Readings after closing time', 'City Central Library', 'Thursdays in July, 9–11 pm'].forEach((s, k) => text(g, s, 80, 880 + k * 40, font(400, 28, F.grot), '#2a2724'));
    [['03.07', 'Anu Varma'], ['10.07', 'Ravi Teja K.'], ['17.07', 'Meera Das'], ['24.07', 'Open floor']].forEach(([d, n], k) => { text(g, d, 600, 880 + k * 40, font(500, 28, F.mono), '#2a2724'); text(g, n, 720, 880 + k * 40, font(500, 28, F.grot), '#2a2724'); });
    g.fillStyle = '#1d1b19'; g.fillRect(80, 1240, 34, 34); g.fillRect(122, 1240, 34, 34); g.fillRect(80, 1282, 34, 34);
    text(g, 'Free entry · citylibrary.in', TW - 80, TH - 90, font(400, 26, F.grot), '#2a2724', 'right');
  },
  salt(g) {
    g.fillStyle = '#f2e6d4'; g.fillRect(0, 0, TW, TH); const R = '#e5392b';
    text(g, 'SALT & SEA', TW / 2, 230, font(400, 210, F.anton), R, 'center');
    g.save(); g.beginPath(); g.rect(80, 300, 300, 300); g.clip(); cover(g, photoImgs.sea, 80, 300, 300, 300); grayscale(g, 80, 300, 300, 300); tint(g, 80, 300, 300, 300, R, 'screen'); g.restore();
    text(g, 'PHOTOGRAPHS BY', 430, 330, font(500, 24, F.mono), R);
    text(g, 'NAINA', 430, 420, font(400, 96, F.anton), R); text(g, 'RAO', 430, 515, font(400, 96, F.anton), R);
    text(g, '12.09', 80, 800, font(400, 150, F.anton), R); text(g, '30.09', 80, 960, font(400, 150, F.anton), R);
    text(g, 'GALLERY', TW - 80, 820, font(400, 120, F.anton), R, 'right'); text(g, 'RUSHIKONDA', TW - 80, 940, font(400, 120, F.anton), R, 'right');
    g.save(); g.beginPath(); g.rect(80, 1060, 260, 200); g.clip(); cover(g, photoImgs.sea, 80, 1060, 260, 200); grayscale(g, 80, 1060, 260, 200); tint(g, 80, 1060, 260, 200, '#2b6cb0', 'multiply'); g.restore();
    text(g, 'OPENING FRI 12.09', TW - 80, 1170, font(400, 66, F.anton), R, 'right'); text(g, '6 PM', TW - 80, 1250, font(400, 66, F.anton), R, 'right');
    text(g, 'Beach Road, Rushikonda · free', 80, TH - 70, font(500, 24, F.mono), R);
  },
  bus(g) {
    g.fillStyle = '#3c5a48'; g.fillRect(0, 0, TW, TH);
    g.save(); g.beginPath(); g.rect(0, 560, TW, TH - 560); g.clip(); cover(g, photoImgs.night, 0, 560, TW, TH - 560); grayscale(g, 0, 560, TW, TH - 560); tint(g, 0, 560, TW, TH - 560, '#3c5a48', 'multiply'); tint(g, 0, 560, TW, TH - 560, 'rgba(255,120,90,.18)', 'screen'); g.restore();
    const R = '#ff5b4a';
    ['LAST', 'BUS', '23:40'].forEach((s, k) => text(g, s, 80, 250 + k * 150, font(700, 170, F.grot), R));
    text(g, 'ROUTE 28 · RTC COMPLEX → BEACH ROAD', 80, 700, font(500, 26, F.mono), '#f6d9c8');
    text(g, 'DAILY POSTER', TW - 80, 120, font(500, 26, F.mono), '#f6d9c8', 'right'); text(g, 'NO. 88', TW - 80, 160, font(500, 26, F.mono), '#f6d9c8', 'right');
    text(g, 'gullypress.in/daily', 80, TH - 70, font(500, 24, F.mono), '#f6d9c8');
  },
  fold(g) {
    g.fillStyle = '#efe6d2'; g.fillRect(0, 0, TW, TH); const C = '#2b2722';
    text(g, 'f.', 90, 210, font(400, 150, F.serif), C);
    g.save(); g.translate(TW - 190, TH - 160); g.rotate(-Math.PI / 2);
    text(g, 'A2', 0, 0, font(700, 120, F.grot), C); rule(g, 0, 40, 520, 40, C, 3); text(g, 'POSTER', 0, 150, font(700, 120, F.grot), C);
    g.restore();
    g.save(); g.translate(330, TH - 120); g.rotate(-Math.PI / 2);
    text(g, 'FOLD PAPER CO.', 0, 0, font(700, 44, F.grot), C); text(g, 'Paper for people who fold things.', 0, 50, font(400, 26, F.grot), C); text(g, 'Siripuram · since 2019', 0, 86, font(400, 26, F.grot), C);
    g.restore();
    text(g, 'fold.in — no. 2 of 6', 90, TH - 80, font(400, 22, F.mono), C);
  },
  open(g) {
    g.fillStyle = '#f2ead7'; g.fillRect(0, 0, TW, TH); const C = '#1c1a17';
    text(g, 'Now', 80, 330, font(700, 260, F.grot), C); text(g, 'open.', 80, 560, font(700, 260, F.grot), C);
    rule(g, 80, 650, TW - 80, 650, C, 3);
    text(g, 'Chai & Vinyl', 80, 740, font(700, 64, F.grot), C);
    ['Records, chai and a very', 'small couch. Siripuram,', 'next to the bakery.'].forEach((s, k) => text(g, s, 80, 820 + k * 50, font(400, 40, F.grot), C));
    for (let y = 0; y < 9; y++) for (let x = 0; x < 9; x++) if ((x * 7 + y * 3 + x * y) % 3 === 0 || x < 2 && y < 2 || x > 6 && y < 2 || x < 2 && y > 6) { g.fillStyle = C; g.fillRect(TW - 380 + x * 34, TH - 420 + y * 34, 32, 32); }
    text(g, 'Opening day: 2 May, 4 pm', 80, TH - 110, font(500, 30, F.mono), C);
  },
  floor(g) {
    g.fillStyle = '#efe7d6'; g.fillRect(0, 0, TW, TH); const O = '#ef5a24', C = '#1b1a18';
    text(g, 'Kalabharathi', 80, 110, font(600, 28, F.grot), C); text(g, 'Dance festival, 3 nights', TW - 80, 110, font(400, 28, F.grot), C, 'right');
    g.save(); g.beginPath(); g.arc(TW / 2, 520, 340, 0, Math.PI * 2); g.fillStyle = O; g.fill(); g.clip();
    cover(g, photoImgs.dance, TW / 2 - 340, 180, 680, 680); grayscale(g, TW / 2 - 340, 180, 680, 680); tint(g, TW / 2 - 340, 180, 680, 680, O, 'multiply'); g.restore();
    text(g, 'Open', 80, 1060, font(700, 190, F.grot), C); text(g, 'Floor', 80, 1230, font(700, 190, F.grot), C);
    [['FRI 14', 'Kuchipudi now'], ['SAT 15', 'Floor work'], ['SUN 16', 'Open floor']].forEach(([d, n], k) => { text(g, d, 640, 960 + k * 56, font(500, 30, F.mono), C); text(g, n, 760, 960 + k * 56, font(600, 30, F.grot), C); });
    rule(g, 640, 1150, TW - 80, 1150, C, 2); text(g, 'Doors 7 pm', 640, 1200, font(500, 28, F.mono), C);
  },
  zine(g) {
    g.fillStyle = '#ff6fae'; g.fillRect(0, 0, TW, TH); const B = '#1f4fd1';
    const img = photoImgs.rose;
    if (img) {
      const tmp = document.createElement('canvas'); tmp.width = 120; tmp.height = 150; const t = tmp.getContext('2d', { willReadFrequently: true }); cover(t, img, 0, 0, 120, 150);
      const d = t.getImageData(0, 0, 120, 150).data; g.fillStyle = B;
      for (let y = 0; y < 150; y++) for (let x = 0; x < 120; x++) { const i = (y * 120 + x) * 4; const l = (d[i] * .3 + d[i + 1] * .59 + d[i + 2] * .11) / 255; const r = (1 - l) * 4.4; if (r > .3) { g.beginPath(); g.arc(120 + x * 6.6 + 6, 90 + y * 6.6 + 6, r, 0, Math.PI * 2); g.fill(); } }
    }
    text(g, 'ZINE', 70, 1180, font(400, 260, F.anton), B); text(g, 'FAIR', 560, 1180, font(400, 260, F.anton), B);
    g.beginPath(); g.arc(TW - 190, 1000, 110, 0, Math.PI * 2); g.fillStyle = '#ffe14a'; g.fill();
    text(g, 'SAT', TW - 190, 990, font(500, 34, F.mono), B, 'center'); text(g, '22.11', TW - 190, 1036, font(500, 34, F.mono), B, 'center');
    text(g, 'Small Press Vizag · 40 tables · riso, zines, comics', 70, TH - 80, font(500, 24, F.mono), B);
  },
  cinema(g) {
    g.fillStyle = '#141210'; g.fillRect(0, 0, TW, TH); const Gd = '#e3b45c';
    g.save(); g.beginPath(); g.rect(80, 80, TW - 160, 560); g.clip(); cover(g, photoImgs.bulbs, 80, 80, TW - 160, 560); tint(g, 80, 80, TW - 160, 560, 'rgba(40,25,10,.25)', 'multiply'); g.restore();
    text(g, 'Under the', 80, 800, font(400, 150, F.serif), Gd);
    g.font = `italic 150px ${F.serif}`; g.fillStyle = Gd; g.textAlign = 'left'; g.fillText('Bridge', 80, 940);
    text(g, 'Open-air cinema · Saturdays in March · 7:30 pm', 80, 1010, font(400, 26, F.grot), '#d9cdb5');
    [['07.03', 'Pather Panchali'], ['14.03', 'Roja'], ['21.03', 'Swades'], ['28.03', 'Short films']].forEach(([d, n], k) => { const col = k % 2, row = Math.floor(k / 2); text(g, d, 80 + col * 440, 1100 + row * 56, font(500, 28, F.mono), Gd); text(g, n, 200 + col * 440, 1100 + row * 56, font(500, 28, F.grot), '#efe6d2'); });
    text(g, 'Cinema by the Bay', 80, TH - 80, font(600, 26, F.grot), '#d9cdb5'); text(g, 'Bring a mat', TW - 80, TH - 80, font(400, 26, F.grot), '#d9cdb5', 'right');
  },
  run(g) {
    g.fillStyle = '#111'; g.fillRect(0, 0, TW, TH); const Y = '#f5c518';
    g.save(); g.beginPath(); g.rect(0, 700, TW, TH - 700); g.clip(); cover(g, photoImgs.road, 0, 700, TW, TH - 700); grayscale(g, 0, 700, TW, TH - 700); tint(g, 0, 700, TW, TH - 700, 'rgba(245,197,24,.55)', 'multiply'); g.restore();
    text(g, '10K', 70, 330, font(400, 300, F.anton), Y); text(g, 'BY NIGHT', 70, 560, font(400, 210, F.anton), Y);
    text(g, 'BEACH ROAD RUNNERS', 74, 640, font(500, 30, F.mono), Y);
    g.fillStyle = Y; g.fillRect(70, TH - 170, TW - 140, 100);
    text(g, 'SAT 13.12 · 21:00 · RK BEACH', TW / 2, TH - 102, font(400, 54, F.anton), '#111', 'center');
  },
  stone(g) {
    g.fillStyle = '#e4dfd5'; g.fillRect(0, 0, TW, TH); const C = '#2a2723';
    rule(g, 80, 90, TW - 80, 90, C, 2); text(g, 'Visakha Museum', 80, 140, font(500, 26, F.grot), C); text(g, '14.02 – 30.05', TW - 80, 140, font(500, 26, F.grot), C, 'right');
    g.fillStyle = '#d3cdc1'; g.fillRect(170, 220, TW - 340, 700);
    g.save(); g.beginPath(); g.rect(210, 260, TW - 420, 620); g.clip(); cover(g, photoImgs.stone, 210, 260, TW - 420, 620); grayscale(g, 210, 260, TW - 420, 620); tint(g, 210, 260, TW - 420, 620, '#c9bfae', 'multiply'); g.restore();
    text(g, 'Soft Stone', TW / 2, 1090, font(400, 140, F.serif), C, 'center');
    text(g, 'Sculpture, slowly. Twelve artists, one material.', TW / 2, 1150, font(400, 28, F.grot), C, 'center');
    rule(g, 80, TH - 130, TW - 80, TH - 130, C, 2); text(g, 'Free on Sundays', 80, TH - 80, font(500, 24, F.grot), C); text(g, 'visakhamuseum.in', TW - 80, TH - 80, font(500, 24, F.grot), C, 'right');
  },
};
function makePoster(p) {
  const c = document.createElement('canvas'); c.width = TW; c.height = TH; const g = c.getContext('2d', { willReadFrequently: true });
  DESIGNS[p.design](g);
  // paper: faint fibres and a soft edge
  const d = g.getImageData(0, 0, TW, TH);
  for (let i = 0; i < d.data.length; i += 4) { const n = (Math.random() - .5) * 10; d.data[i] += n; d.data[i + 1] += n; d.data[i + 2] += n; }
  g.putImageData(d, 0, 0);
  const t = new THREE.CanvasTexture(c); t.colorSpace = THREE.SRGBColorSpace; t.anisotropy = renderer.capabilities.getMaxAnisotropy();
  return t;
}

/* chalk outline + words for the end of the street */
function chalkTex() {
  const c = document.createElement('canvas'); c.width = 1024; c.height = 1448; const g = c.getContext('2d', { willReadFrequently: true });
  g.strokeStyle = 'rgba(245,242,235,.85)'; g.lineWidth = 9; g.lineCap = 'round'; g.setLineDash([46, 30]);
  g.strokeRect(40, 40, 944, 1368); g.setLineDash([]);
  g.fillStyle = 'rgba(245,242,235,.9)'; g.textAlign = 'center';
  g.font = '500 150px Caveat, cursive'; g.fillText('your poster', 512, 640); g.fillText('here', 512, 800);
  g.lineWidth = 7; g.beginPath(); g.moveTo(330, 870); g.quadraticCurveTo(512, 930, 700, 860); g.stroke();
  const d = g.getImageData(0, 0, 1024, 1448); for (let i = 3; i < d.data.length; i += 4) if (d.data[i] > 0) d.data[i] *= .55 + Math.random() * .45; g.putImageData(d, 0, 0);
  const t = new THREE.CanvasTexture(c); t.colorSpace = THREE.SRGBColorSpace; return t;
}
function shadowTex() {
  const c = document.createElement('canvas'); c.width = 256; c.height = 340; const g = c.getContext('2d', { willReadFrequently: true });
  g.filter = 'blur(14px)'; g.fillStyle = '#000'; g.fillRect(40, 40, 176, 260);
  const t = new THREE.CanvasTexture(c); return t;
}
const SHADOW = shadowTex();

/* ================================================================
   POSTER MESHES (curl in the vertex shader, same street light)
   ================================================================ */
const posterGeo = new THREE.PlaneGeometry(PW, PH, 24, 34);
const posterVert = `
  uniform float uCurl, uWave, uTime, uSeed;
  varying vec2 vUv; varying vec2 vW;
  void main(){
    vUv = uv; vec3 p = position;
    float ty = uv.y, tx = uv.x;
    p.z += uCurl * (pow(ty, 2.2) * 1.6 + pow(1.0 - tx, 2.0) * 0.5);
    p.y -= uCurl * pow(ty, 2.0) * 0.35;
    p.z += uWave * sin(tx * 3.1 + uTime * 2.4 + uSeed * 6.0) * 0.12 * (0.4 + ty);
    vec4 w = modelMatrix * vec4(p, 1.0); vW = w.xy;
    gl_Position = projectionMatrix * viewMatrix * w;
  }`;
const posterFrag = `
  ${GLSL_COMMON}
  uniform sampler2D uTex; uniform float uOpacity, uFlat, uLeaf, uHover; varying vec2 vUv; varying vec2 vW;
  void main(){
    vec3 c = texture2D(uTex, vUv).rgb;
    float edge = smoothstep(0.0, 0.03, min(min(vUv.x, 1.0 - vUv.x), min(vUv.y, 1.0 - vUv.y)));
    c *= 0.9 + 0.1 * edge;
    vec3 lit = lightAt(c, vW, uLeaf) * (1.08 + uHover * 0.12);
    vec3 flatc = c * mix(0.92, 1.0, uDay);
    gl_FragColor = vec4(mix(lit, flatc, uFlat), uOpacity);
    #include <colorspace_fragment>
  }`;
function posterMaterial(tex, leaf) {
  return new THREE.ShaderMaterial({
    uniforms: { ...shared, uTex: { value: tex }, uOpacity: { value: 1 }, uFlat: { value: 0 }, uLeaf: { value: leaf }, uHover: { value: 0 }, uCurl: { value: 0 }, uWave: { value: 0 }, uSeed: { value: Math.random() } },
    vertexShader: posterVert, fragmentShader: posterFrag, transparent: true, side: THREE.DoubleSide, depthWrite: true,
  });
}
const posters = [];
const rnd = (a, b, s) => a + (b - a) * ((Math.sin(s * 91.7) * 43758.5453) % 1 + 1) % 1;
P.forEach((p, i) => {
  const mat = posterMaterial(null, p.leaf);
  const mesh = new THREE.Mesh(posterGeo, mat); mesh.userData.i = i;
  const sh = new THREE.Mesh(new THREE.PlaneGeometry(PW * 1.25, PH * 1.2), new THREE.MeshBasicMaterial({ map: SHADOW, transparent: true, depthWrite: false, color: 0x000000, opacity: .5 }));
  scene.add(sh); scene.add(mesh);
  const base = { x: rnd(-0.7, 0.9, i + 1), y: i * SEG + rnd(-0.4, 0.4, i + 7), r: rnd(-0.32, 0.32, i + 3) };
  const extras = [];
  if (p.pile) {
    mesh.scale.setScalar(0.5);
    for (let k = 0; k < 9; k++) {
      const m = new THREE.Mesh(posterGeo, mat.clone()); m.material.uniforms = { ...mat.uniforms, uOpacity: { value: 1 }, uCurl: { value: 0 }, uWave: { value: 0 }, uHover: { value: 0 }, uFlat: { value: 0 }, uSeed: { value: Math.random() } };
      m.scale.setScalar(0.5); const a = rnd(0, 6.28, k + 40), rr = rnd(0.6, 2.6, k + 50);
      m.position.set(base.x + Math.cos(a) * rr * 1.25, base.y + Math.sin(a) * rr, 0.03 + k * 0.006); m.rotation.z = rnd(-1.4, 1.4, k + 60) + (k % 3 === 0 ? Math.PI : 0);
      const ms = new THREE.Mesh(sh.geometry, sh.material.clone()); ms.scale.setScalar(0.5); ms.position.set(m.position.x + 0.05, m.position.y - 0.07, 0.012); ms.rotation.z = m.rotation.z; ms.material.opacity = .35;
      scene.add(ms); scene.add(m); extras.push(m);
    }
  }
  posters.push({ p, mesh, mat, sh, base, extras, mode: 'street', lift: 0, hover: 0 });
});
const chalk = new THREE.Mesh(posterGeo, new THREE.MeshBasicMaterial({ map: null, transparent: true, depthWrite: false, opacity: 0 }));
chalk.position.set(0.2, N * SEG, 0.012); chalk.rotation.z = -0.05; scene.add(chalk);

/* dimmer for the picked-up view */
const dimMat = new THREE.MeshBasicMaterial({ color: 0x000000, transparent: true, opacity: 0, depthWrite: false });
const dim = new THREE.Mesh(new THREE.PlaneGeometry(200, 200), dimMat); dim.position.z = 0.9; scene.add(dim);

/* ================================================================
   LAYOUT / SCROLL
   ================================================================ */
let step = 600;
function layout() {
  const w = innerWidth, h = innerHeight, a = w / h;
  renderer.setSize(w, h, false);
  shared.uRes.value.set(w * renderer.getPixelRatio(), h * renderer.getPixelRatio());
  camera.aspect = a; camera.fov = a < 0.8 ? 40 : 32; camera.updateProjectionMatrix();
  const tan = Math.tan(THREE.MathUtils.degToRad(camera.fov / 2));
  CAM_Z = a < 0.8 ? (PW / 0.62) / (2 * tan * a) : (PH / 0.6) / (2 * tan);
  step = Math.max(420, h * 0.7);
  document.getElementById('space').style.height = (h + step * N) + 'px';
}
const state = { p: 0, pt: 0, open: false, active: -1, hovered: -1, ready: false, idx: -1, time: 0, mx: 0, my: 0, smx: 0, smy: 0, intro: 1, end: 0 };
let snapT;
addEventListener('scroll', () => {
  if (state.open) return;
  state.pt = THREE.MathUtils.clamp(scrollY / step, 0, N);
  clearTimeout(snapT);
  snapT = setTimeout(() => { if (!state.open) { const t = Math.round(state.pt) * step; if (Math.abs(scrollY - t) > 2) scrollTo({ top: t, behavior: 'smooth' }); } }, 170);
}, { passive: true });
addEventListener('resize', () => { layout(); });

/* ================================================================
   UI
   ================================================================ */
const $ = id => document.getElementById(id);
const root = document.documentElement;
$('ticks').innerHTML = P.map((p, i) => `<button data-i="${i}" aria-label="${p.name}"><span>${p.name}</span><i></i></button>`).join('');
const tickBtns = [...$('ticks').children];
$('index').innerHTML = P.map((p, i) => `<button data-i="${i}"><span class="n">${pad2(i + 1)}</span><i class="d" style="background:${p.dot}"></i><span class="b">${p.name}</span><span class="c">${p.kind}</span><span class="y">${p.year}</span></button>`).join('');
const idxBtns = [...$('index').children];
function goTo(i) { toggleIndex(false); toggleContact(false); scrollTo({ top: i * step, behavior: 'smooth' }); }
$('ticks').addEventListener('click', e => { const b = e.target.closest('button'); if (b) goTo(+b.dataset.i); });
$('index').addEventListener('click', e => { const b = e.target.closest('button'); if (b) goTo(+b.dataset.i); });
function toggleIndex(f) { const on = f ?? !document.body.classList.contains('index-open'); document.body.classList.toggle('index-open', on); if (on) document.body.classList.remove('contact-open'); }
function toggleContact(f) { const on = f ?? !document.body.classList.contains('contact-open'); document.body.classList.toggle('contact-open', on); if (on) document.body.classList.remove('index-open'); }
$('indexBtn').addEventListener('click', e => { e.stopPropagation(); toggleIndex(); });
$('contactBtn').addEventListener('click', e => { e.stopPropagation(); toggleContact(); });
canvas.addEventListener('pointerdown', () => { toggleIndex(false); toggleContact(false); });
$('copy').addEventListener('click', () => { navigator.clipboard?.writeText('hello@gullypress.in'); });
$('restart').addEventListener('click', () => scrollTo({ top: 0, behavior: 'smooth' }));
addEventListener('keydown', e => {
  if (state.open) { if (e.key === 'Escape') closeCase(); if (e.key === 'ArrowRight') switchCase(1); return; }
  if (e.key === 'Escape') { toggleIndex(false); toggleContact(false); }
});
const MOON = '<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/>', SUN = '<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/>';
$('theme').addEventListener('click', () => {
  const day = root.dataset.theme !== 'day'; root.dataset.theme = day ? 'day' : 'night'; $('ico').innerHTML = day ? SUN : MOON;
  gsap.to(shared.uDay, { value: day ? 1 : 0, duration: 1.2, ease: 'power2.inOut' });
  renderer.setClearColor(day ? 0xd9d4cb : 0x0b0a09, 1);
});

function setHero(i, instant) {
  const p = P[i];
  root.style.setProperty('--active', p.dot);
  tickBtns.forEach((b, k) => b.classList.toggle('on', k === i));
  idxBtns.forEach((b, k) => b.classList.toggle('cur', k === i));
  const meta = `${p.kind} · ${p.client} · ${p.year}`;
  const wheel = $('wheel'), old = wheel.lastElementChild, nu = document.createElement('span'); nu.textContent = pad2(i + 1);
  if (instant) { wheel.innerHTML = ''; wheel.appendChild(nu); $('title').textContent = p.name; $('meta').textContent = meta; return; }
  const dir = i > state.idx ? 1 : -1;
  nu.style.position = 'absolute'; nu.style.left = 0; nu.style.top = 0; wheel.appendChild(nu);
  gsap.fromTo(nu, { yPercent: 100 * dir }, { yPercent: 0, duration: .6, ease: 'expo.out' });
  gsap.to(old, { yPercent: -100 * dir, duration: .6, ease: 'expo.out', onComplete: () => { old.remove(); nu.style.position = ''; } });
  const t = $('title'); gsap.killTweensOf(t);
  gsap.to(t, { opacity: .2, filter: 'blur(10px)', y: -8, duration: .18, ease: 'power2.in', onComplete: () => {
    t.textContent = p.name; $('meta').textContent = meta;
    gsap.fromTo(t, { opacity: .2, filter: 'blur(12px)', y: 10 }, { opacity: 1, filter: 'blur(0px)', y: 0, duration: .6, ease: 'expo.out' });
  } });
}

/* ================================================================
   HOVER + PICK UP
   ================================================================ */
const ray = new THREE.Raycaster(), ndc = new THREE.Vector2();
let cx = -999, cy = -999;
const hpill = $('hpill');
addEventListener('pointermove', e => { cx = e.clientX; cy = e.clientY; state.mx = cx / innerWidth * 2 - 1; state.my = -(cy / innerHeight) * 2 + 1; hpill.style.left = cx + 'px'; hpill.style.top = cy + 'px'; });
function pick(x, y) {
  ndc.set(x / innerWidth * 2 - 1, -(y / innerHeight) * 2 + 1); ray.setFromCamera(ndc, camera);
  const list = posters.filter(o => o.mode === 'street' && o.mat.uniforms.uOpacity.value > .5).map(o => o.mesh);
  const hit = ray.intersectObjects(list)[0]; return hit ? hit.object.userData.i : -1;
}
canvas.addEventListener('click', e => { if (!state.ready || state.open || state.end > .5) return; const i = pick(e.clientX, e.clientY); if (i > -1) openCase(i); });

const caseEl = $('case');
function fillCase(i) {
  const p = P[i]; root.style.setProperty('--active', p.dot);
  $('ck').textContent = `${p.kind} · ${p.year}`; $('cb').textContent = p.name; $('cc').textContent = `For ${p.client}`; $('cd').textContent = p.desc;
  $('cr').innerHTML = [['Format', p.format], ['Print', p.print], ['Run', p.run], ['Paper', p.paper]].map(([a, b]) => `<div><span>${a}</span><span>${b}</span></div>`).join('');
  $('nextn').textContent = P[(i + 1) % N].name;
}
function targetPose() {
  const r = $('media').getBoundingClientRect();
  const Z = 6.5, dist = CAM_Z - Z;
  const vh = 2 * dist * Math.tan(THREE.MathUtils.degToRad(camera.fov / 2)), vw = vh * camera.aspect;
  let w = r.width, h = r.height; if (w / h > PW / PH) w = h * PW / PH; else h = w * PH / PW;
  const s = (h / innerHeight) * vh / PH;
  const nx = ((r.left + r.width / 2) / innerWidth) * 2 - 1, ny = -((r.top + r.height / 2) / innerHeight) * 2 + 1;
  return { x: camera.position.x + nx * vw / 2, y: camera.position.y + ny * vh / 2, z: Z, s };
}
function openCase(i) {
  state.open = true; state.active = i; clearTimeout(snapT); hpill.classList.remove('on'); state.hovered = -1; canvas.style.cursor = '';
  fillCase(i); document.body.classList.add('case-open'); root.classList.add('locked'); caseEl.setAttribute('aria-hidden', 'false');
  const o = posters[i]; o.mode = 'case';
  o.from = { x: o.mesh.position.x, y: o.mesh.position.y, z: o.mesh.position.z, r: o.mesh.rotation.z, s: o.mesh.scale.x }; o.t = 0;
  gsap.to(o, { t: 1, duration: reduced ? .01 : 1.15, ease: 'expo.inOut' });
  gsap.timeline().to(o.mat.uniforms.uCurl, { value: .55, duration: .45, ease: 'power2.out' }).to(o.mat.uniforms.uCurl, { value: 0, duration: .7, ease: 'power3.inOut' });
  gsap.to(o.mat.uniforms.uFlat, { value: 1, duration: 1 });
  gsap.to(dimMat, { opacity: .55, duration: .9 });
  setTimeout(() => caseEl.classList.add('show'), 480);
}
function closeCase() {
  if (!state.open) return;
  const i = state.active, o = posters[i];
  caseEl.classList.remove('show'); document.body.classList.remove('case-open'); caseEl.setAttribute('aria-hidden', 'true');
  o.mode = 'back'; o.from = { x: o.mesh.position.x, y: o.mesh.position.y, z: o.mesh.position.z, r: o.mesh.rotation.z, s: o.mesh.scale.x }; o.t = 0;
  gsap.to(o, { t: 1, duration: reduced ? .01 : 1.05, ease: 'expo.inOut', onComplete: () => { o.mode = 'street'; } });
  gsap.timeline().to(o.mat.uniforms.uCurl, { value: .45, duration: .4 }).to(o.mat.uniforms.uCurl, { value: 0, duration: .65, ease: 'power3.inOut' });
  gsap.to(o.mat.uniforms.uFlat, { value: 0, duration: .9 });
  gsap.to(dimMat, { opacity: 0, duration: .8 });
  root.classList.remove('locked'); scrollTo(0, i * step); state.pt = i; state.open = false; state.active = -1;
}
function switchCase(dir) {
  if (!state.open) return;
  const ni = (state.active + dir + N) % N;
  closeCase(); setTimeout(() => openCase(ni), 950);
}
$('close').addEventListener('click', closeCase);
$('nextp').addEventListener('click', () => switchCase(1));

/* ================================================================
   LOOP
   ================================================================ */
const clock = new THREE.Clock();
function easeIO(x) { x = Math.min(1, Math.max(0, x)); return x * x * (3 - 2 * x); }
function streetPose(o, i, out) {
  const d = state.p - i;                   // >0: walked past it, <0: still ahead
  let x = o.base.x, y = o.base.y, z = 0.03, r = o.base.r, s = o.p.pile ? 0.5 : 1, lift = 0, curl = 0, op = 1, wave = 0;
  if (d > 0) {                             // the wind takes it
    const k = easeIO(d / 1.0);
    lift = k * 2.6; y += d * SEG * 1.22; x += k * 1.4; r += k * 0.8; curl = Math.sin(Math.min(d, 1) * Math.PI) * 0.65 + k * 0.2;
    op = 1 - easeIO((d - 0.3) / 0.5); wave = k;
  } else if (d > -1.3) {                   // it is still settling
    const k = easeIO((-d) / 1.3);
    lift = k * 1.8; r += k * 0.45; x -= k * 0.5; y += k * 0.6; curl = k * 0.3; wave = k;
  }
  if (state.intro > 0 && i < 2) { lift += state.intro * 3.5; curl += state.intro * 0.4; r += state.intro * 0.6; }
  out.x = x; out.y = y; out.z = z + lift; out.r = r; out.s = s; out.lift = lift; out.curl = curl; out.op = op; out.wave = wave;
  return out;
}
const pose = {};
function tick() {
  const dt = Math.min(clock.getDelta(), .05); state.time += dt; shared.uTime.value = state.time;
  state.p += (state.pt - state.p) * (1 - Math.exp(-dt * 4));
  if (!state.open) { state.smx += (state.mx - state.smx) * .04; state.smy += (state.my - state.smy) * .04; }
  state.end = THREE.MathUtils.smoothstep(state.p, N - 1, N);
  document.body.classList.toggle('at-end', state.end > .55 && !state.open);

  camera.position.set(state.smx * 0.25, state.p * SEG + state.smy * 0.2 - 0.5, CAM_Z + state.intro * 6);
  camera.rotation.set(state.smy * 0.015, -state.smx * 0.02, 0);
  dim.position.set(camera.position.x, camera.position.y, 0.9);

  const ai = THREE.MathUtils.clamp(Math.round(Math.min(state.p, N - 1)), 0, N - 1);
  if (ai !== state.idx && state.ready && !state.open) { setHero(ai, state.idx < 0); state.idx = ai; }

  if (!isTouch && state.ready && !state.open && state.end < .5) {
    const h = pick(cx, cy);
    if (h !== state.hovered) { state.hovered = h; if (h > -1) { $('hname').textContent = P[h].name; hpill.classList.add('on'); canvas.style.cursor = 'pointer'; } else { hpill.classList.remove('on'); canvas.style.cursor = ''; } }
  }

  posters.forEach((o, i) => {
    const u = o.mat.uniforms; o.hover += ((state.hovered === i ? 1 : 0) - o.hover) * .12; u.uHover.value = o.hover;
    streetPose(o, i, pose);
    pose.z += o.hover * 0.35; pose.curl += o.hover * 0.12;
    if (o.mode === 'street') {
      o.mesh.position.set(pose.x, pose.y, pose.z); o.mesh.rotation.z = pose.r; o.mesh.scale.setScalar(pose.s);
      u.uCurl.value = pose.curl; u.uWave.value = pose.wave; u.uOpacity.value = pose.op;
    } else {
      const T = o.mode === 'case' ? targetPose() : { x: pose.x, y: pose.y, z: pose.z, s: pose.s };
      const k = o.mode === 'case' ? o.t : o.t, A = o.mode === 'case' ? o.from : o.from, B = T;
      o.mesh.position.set(THREE.MathUtils.lerp(A.x, B.x, k), THREE.MathUtils.lerp(A.y, B.y, k), THREE.MathUtils.lerp(A.z, B.z, k) + Math.sin(k * Math.PI) * 1.2);
      o.mesh.rotation.z = THREE.MathUtils.lerp(A.r, o.mode === 'case' ? 0 : pose.r, k);
      o.mesh.scale.setScalar(THREE.MathUtils.lerp(A.s, B.s, k)); u.uOpacity.value = 1; u.uWave.value = 0;
    }
    // shadow: offset grows with height, softer and lighter
    const L = Math.max(0, o.mesh.position.z - 0.03);
    o.sh.position.set(o.mesh.position.x + 0.05 + L * 0.32, o.mesh.position.y - 0.08 - L * 0.5, 0.012);
    o.sh.rotation.z = o.mesh.rotation.z; o.sh.scale.setScalar(o.mesh.scale.x * (0.86 + L * 0.06));
    o.sh.material.opacity = Math.max(0, (0.55 - L * 0.045)) * u.uOpacity.value * (o.mode === 'street' ? 1 : 0.8) * (1 - shared.uDay.value * .25);
  });
  chalk.material.opacity = 0.75 * THREE.MathUtils.smoothstep(state.p, N - 0.6, N) * (1 - shared.uDay.value * .4);

  renderer.render(scene, camera);
  requestAnimationFrame(tick);
}

/* ================================================================
   BOOT
   ================================================================ */
async function boot() {
  layout();
  try { await Promise.race([Promise.all(['700 80px "Familjen Grotesk"', '80px "Instrument Serif"', '80px Anton', '30px "DM Mono"', '500 80px Caveat'].map(f => document.fonts.load(f))), new Promise(r => setTimeout(r, 3000))]); } catch (e) {}
  await Promise.all(Object.entries(PHOTOS).map(([k, src]) => new Promise(res => { const im = new Image(); im.crossOrigin = 'anonymous'; im.onload = () => { photoImgs[k] = im; res(); }; im.onerror = () => res(); im.src = src; })));
  posters.forEach(o => { const t = makePoster(o.p); o.mat.uniforms.uTex.value = t; o.extras.forEach(m => m.material.uniforms.uTex = { value: t }); });
  chalk.material.map = chalkTex(); chalk.material.needsUpdate = true;
  state.p = state.pt = THREE.MathUtils.clamp(scrollY / step, 0, N);
  requestAnimationFrame(tick);
  $('loader').classList.add('done'); state.ready = true;
  gsap.to(state, { intro: 0, duration: reduced ? .01 : 2.6, ease: 'expo.out' });
  setTimeout(() => document.body.classList.add('ready'), 600);
}
boot();
</script>
</body>
</html>

Your AI tool
Starter prompt

		

Download the plan