// services-hero.jsx: Viewfinder hero for services page. Mode dial (services-data.js SERVICES_HERO), // focus-ring lens, rack focus between modes, iris shutter closing onto the services overview. // Needs hero-fx.js + engine.js. Exposes ServicesHero on window. function ServicesHero() { const C = (window.SITE_CONTENT && window.SITE_CONTENT.servicesPage) || {}; const svcs = SERVICES_DATA.map((s, i) => Object.assign({}, s, SERVICES_HERO[i])); const { mobile: mob } = useViewport(); const [cat, setCat] = React.useState(0); const [picked, setPicked] = React.useState(false); const heroRef = React.useRef(null), stageRef = React.useRef(null), screenRef = React.useRef(null), sceneRef = React.useRef(null), blurRef = React.useRef(null), focusRef = React.useRef(null); const swapRef = React.useRef(null), hintRef = React.useRef(null), ringRef = React.useRef(null), peakRef = React.useRef(null), afRef = React.useRef(null), tcRef = React.useRef(null), titleRef = React.useRef(null), irisRef = React.useRef(null), stmtRef = React.useRef(null); const S = React.useRef({ mob, cat: 0, ptr: { x: 0, y: 0, in: false, down: false, sx: 0, moved: 0 }, rack: null, hunt: { at: 0 } }).current; S.mob = mob; const labels = true, itemW = mob ? 104 : 124, n = svcs.length; const playRow = (i) => { const root = heroRef.current; if (!root) return; root.querySelectorAll('[data-row]').forEach((r) => r.querySelectorAll('[data-clip]').forEach((el) => (+r.getAttribute('data-row') === i ? LL.clip(el).play() : LL.clip(el).pause()))); }; const setMode = (i) => { if (i === S.cat || S.rack || i < 0 || i >= n) return; if (LL.REDUCED) { S.cat = i; setCat(i); playRow(i); return; } S.rack = { t: 0, to: i, swapped: false }; S.picked = true; setPicked(true); const sw = swapRef.current; if (sw) Array.from(sw.children).forEach((el, k) => el.animate([{ opacity: 1, transform: 'none' }, { opacity: 0, transform: 'translateY(-14px) rotate(-2deg)' }], { duration: 260, delay: k * 50, easing: 'cubic-bezier(.55,0,1,.45)', fill: 'forwards' })); }; React.useEffect(() => { const sw = swapRef.current; if (!sw || !S.picked || LL.REDUCED) return; Array.from(sw.children).forEach((el, k) => { el.getAnimations().forEach((a) => a.cancel()); el.animate([{ opacity: 0, transform: 'translateY(18px) rotate(2deg) scale(.96)' }, { opacity: 1, transform: 'none' }], { duration: 700, delay: 60 + k * 90, easing: LL.EASE.bouncy, fill: 'backwards' }); }); }, [cat]); React.useEffect(() => { Engine.invalidate(heroRef.current); playRow(0); S.t0 = performance.now(); if (!LL.REDUCED) { const sc = screenRef.current; sc.animate([{ clipPath: 'inset(48% 48% 48% 48% round 28px)' }, { clipPath: 'inset(0 0 0 0 round 28px)' }], { duration: 1100, delay: 100, easing: LL.EASE.out, fill: 'backwards' }); titleRef.current.animate([{ opacity: 0, transform: 'translateY(40px)' }, { opacity: 1, transform: 'none' }], { duration: 900, delay: 700, easing: LL.EASE.spring, fill: 'backwards' }); S.blurIn = performance.now(); } }, []); // scroll settle: glide to the nearest fully-played state (viewfinder, services overview) React.useEffect(() => Engine.snap(heroRef.current, [0, 0.9]), []); React.useEffect(() => { const w = Engine.w, red = LL.REDUCED; return Engine.add((dt, now) => { const root = heroRef.current, sc = screenRef.current, stg = stageRef.current; if (!root || !sc || !Engine.vis(root)) return; const Wd = sc.clientWidth, Hd = sc.clientHeight, mobile = S.mob, ptr = S.ptr; const p = Engine.prog(root); if (!S.pos) { S.pos = { x: new LL.Spring(Wd * 0.55, 210, 24), y: new LL.Spring(Hd * 0.5, 210, 24) }; S.blur = new LL.Spring(10, 110, 8); } const el = (now - S.t0) / 1000, ff = Math.floor((el % 1) * 25), ss = Math.floor(el) % 60, mm = Math.floor(el / 60) % 60; w(tcRef.current, '@text', `00:${String(mm).padStart(2, '0')}:${String(ss).padStart(2, '0')}:${String(ff).padStart(2, '0')}`); if (!red) w(sceneRef.current, 'transform', `translate(${(Math.sin(now / 1700) * 4).toFixed(2)}px,${(Math.cos(now / 2300) * 3).toFixed(2)}px) rotate(${(Math.sin(now / 3100) * 0.25).toFixed(3)}deg)`); const R = mobile ? Math.min(Wd * 0.28, 110) : Math.min(140, Wd * 0.1); let tx, ty; if (ptr.in && !mobile) { tx = ptr.x; ty = ptr.y; } else { if (now > S.hunt.at) { S.hunt = { at: now + 2600, x: Wd * (0.28 + Math.random() * 0.44), y: Math.min(Hd * (mobile ? 0.44 + Math.random() * 0.22 : 0.34 + Math.random() * 0.34), Hd - 150 - R) }; S.blur.x = Math.max(S.blur.x, 7); } tx = S.hunt.x; ty = S.hunt.y; if (ptr.tapAt && now - ptr.tapAt < 4000) { tx = ptr.tx; ty = ptr.ty; } } S.pos.x.t = tx; S.pos.y.t = ty; if (red) { S.pos.x.x = tx; S.pos.y.x = ty; } else { S.pos.x.step(dt); S.pos.y.step(dt); } const x = S.pos.x.x, y = S.pos.y.x, sp = Math.hypot(S.pos.x.v, S.pos.y.v); S.blur.t = sp > 220 ? 9 : 0; if (red) S.blur.x = 0; else S.blur.step(dt); let rackB = 0; if (S.rack) { S.rack.t += dt / 0.62; rackB = Math.sin(Math.min(1, S.rack.t) * Math.PI) * 22; if (!S.rack.swapped && S.rack.t >= 0.5) { S.rack.swapped = true; const to = S.rack.to; S.cat = to; setCat(to); playRow(to); } if (S.rack.t >= 1) S.rack = null; } const intro = S.blurIn ? LL.range(now - S.blurIn, 0, 1400) : 1; const fb = Math.abs(S.blur.x) + rackB + (1 - intro) * 14; const fc = focusRef.current; // mask (not clip-path): clip-path + backdrop-filter blurs the whole bounding box, which shows as a square around the lens const fm = `radial-gradient(circle at ${x.toFixed(1)}px ${y.toFixed(1)}px, #000 ${Math.max(0, R - 1).toFixed(1)}px, transparent ${(R + 0.5).toFixed(1)}px)`; w(fc, 'webkitMaskImage', fm); w(fc, 'maskImage', fm); const v = fb > 0.25 ? `blur(${fb.toFixed(1)}px)` : 'none'; w(fc, 'backdropFilter', v); w(fc, 'webkitBackdropFilter', v); const bl = blurRef.current; const bv = `blur(${(9 + rackB * 0.6).toFixed(1)}px) saturate(.92)`; w(bl, 'backdropFilter', bv); w(bl, 'webkitBackdropFilter', bv); const m = `radial-gradient(circle at ${x.toFixed(1)}px ${y.toFixed(1)}px, transparent ${R - 2}px, #000 ${R + 26}px)`; w(bl, 'webkitMaskImage', m); w(bl, 'maskImage', m); const locked = fb < 0.5 && sp < 60; w(ringRef.current, 'opacity', intro > 0.6 ? '1' : '0'); w(ringRef.current, 'transform', `translate(${x.toFixed(1)}px,${y.toFixed(1)}px) scale(${(R / 100 * (1 + Math.min(fb, 12) * 0.012)).toFixed(4)})`); w(peakRef.current, 'opacity', locked ? '1' : '0'); w(peakRef.current, 'transform', locked ? 'scale(1)' : 'scale(1.25)'); w(afRef.current, 'opacity', locked ? '1' : '0'); // iris shutter const iris = irisRef.current, SW = stg.clientWidth, SH = stg.clientHeight, far = Math.hypot(SW, SH) / 2 / Math.cos(Math.PI / 8) + 30; const close = LL.range(p, 0.18, 0.5), open = LL.range(p, 0.56, 0.86); const shut = red ? 0 : (p < 0.53 ? LL.easeInOut(close) : 1 - LL.easeInOut(open)); w(sc, 'visibility', p < 0.53 ? 'visible' : 'hidden'); if (red) w(sc, 'opacity', (1 - LL.range(p, 0.3, 0.5)).toFixed(3)); w(iris, 'visibility', shut > 0.001 ? 'visible' : 'hidden'); const d = far * (1 - shut) - 2, tw = shut * 50; // blade edges catch the light while fanning, but should disappear into a clean seal once // fully closed — otherwise the highlight lines stay visible as a gold "crack" starburst const edgeA = (shut < 0.85 ? 100 : Math.max(0, (1 - shut) / 0.15 * 100)).toFixed(0) + '%'; Engine.qa(iris, '[data-blade]').forEach((b) => { const i = +b.getAttribute('data-blade'); w(b, 'transform', `rotate(${i * 45 + tw}deg) translateX(${d.toFixed(1)}px)`); w(b, '--edge-a', edgeA); }); const e = red ? LL.range(p, 0.45, 0.6) : LL.easeOut(LL.range(p, 0.6, 0.9)); w(stmtRef.current, 'opacity', e.toFixed(3)); w(stmtRef.current, 'transform', red ? 'none' : `scale(${(0.94 + 0.06 * e).toFixed(4)})`); }); }, []); const local = (e) => { const r = screenRef.current.getBoundingClientRect(); return { x: e.clientX - r.left, y: e.clientY - r.top }; }; const c = svcs[cat]; const dialW = mob ? itemW * 3 : itemW * 4; return (
✦({C.overviewEyebrow || 'What I do'})

{C.overviewTitle || 'Four ways to'} {C.overviewTitleEm || 'work together.'}

{svcs.map((s) => ( {s.n} · {s.tag} {s.name} {s.line} ))}
{ const q = local(e); if (e.pointerType !== 'touch') { S.ptr.x = q.x; S.ptr.y = q.y; S.ptr.in = true; } if (S.ptr.down) S.ptr.moved = q.x - S.ptr.sx; }} onPointerDown={(e) => { const q = local(e); S.ptr.down = true; S.ptr.sx = q.x; S.ptr.sy = q.y; S.ptr.moved = 0; }} onPointerUp={(e) => { if (!S.ptr.down) return; S.ptr.down = false; const m = S.ptr.moved; if (Math.abs(m) > 40) { setMode(LL.clamp(S.cat + (m < 0 ? 1 : -1), 0, n - 1)); return; } if (e.pointerType === 'touch') { S.ptr.tapAt = performance.now(); S.ptr.tx = S.ptr.sx; S.ptr.ty = S.ptr.sy; if (S.blur) S.blur.x = 8; } }} onPointerCancel={() => { S.ptr.down = false; }} onPointerLeave={() => { S.ptr.in = false; S.ptr.down = false; }}>
); } Object.assign(window, { ServicesHero });