"use client"; /* ═══════════════════════════════════════════════════════════════════════ Team cards share one visual and one GSAP choreography in both places: the full-width overview grid and the individual biography sections. Fine pointers play on hover/focus; touch layouts play while scrolling. Reduced-motion users get a static, readable state. ═══════════════════════════════════════════════════════════════════════ */ import { useEffect, useRef } from "react"; import type { RefObject } from "react"; import { ArrowUpRight, EnvelopeSimple, LinkedinLogo } from "@phosphor-icons/react"; import { gsap } from "gsap"; import { MotionPathPlugin } from "gsap/dist/MotionPathPlugin"; import { ScrollTrigger } from "gsap/dist/ScrollTrigger"; import { TEAM_MEMBERS, teamProfileId } from "./team"; type Member = (typeof TEAM_MEMBERS)[number]; const CSS = ` .hg-team{ --yellow:#f1b729; } .hg-team--overview{ width:100%; } .hg-team .team-grid{ width:100%; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); column-gap:clamp(10px,1.35vw,28px); row-gap:clamp(16px,2vw,40px); } .hg-team .team-member, .hg-team .team-profile__portrait{ min-width:0; container-type:inline-size; } .hg-team .team-card{ --card-radius:clamp(12px,6.54cqw,38px); --card-halo-blur:clamp(4px,1.73cqw,12px); position:relative; display:block; isolation:isolate; aspect-ratio:4/5; overflow:hidden; border-radius:var(--card-radius); background:#e8f4f4; color:inherit; text-decoration:none; cursor:pointer; box-shadow:0 18px 48px rgba(17,18,15,.11); outline:0 solid transparent; -webkit-tap-highlight-color:transparent; will-change:transform,box-shadow; } .hg-team .team-card--display{ cursor:default; } .hg-team .team-card:focus-visible{ outline:3px solid #101010; outline-offset:5px; } .hg-team .team-card::before{ position:absolute; top:10%; right:18%; bottom:2%; left:18%; z-index:2; content:""; border-radius:48% 52% 44% 56% / 30% 32% 68% 70%; opacity:.88; backdrop-filter:blur(var(--card-halo-blur)) saturate(.74); -webkit-backdrop-filter:blur(var(--card-halo-blur)) saturate(.74); -webkit-mask-image:radial-gradient(ellipse at 50% 48%, #000 0 50%, rgba(0,0,0,.82) 64%, transparent 82%); mask-image:radial-gradient(ellipse at 50% 48%, #000 0 50%, rgba(0,0,0,.82) 64%, transparent 82%); pointer-events:none; } .hg-team .team-card__backdrop{ position:absolute; inset:4.2%; z-index:1; overflow:hidden; border-radius:calc(var(--card-radius)*.72); background:#2b2d2a; filter:grayscale(0) saturate(.93) brightness(.79) blur(0); transform-origin:50% 52%; will-change:transform,filter; } .hg-team .team-card__backdrop img, .hg-team .team-card__person{ width:100%; height:100%; object-fit:cover; object-position:50% 50%; user-select:none; -webkit-user-drag:none; } .hg-team .team-card__backdrop img{ position:absolute; inset:0; } .hg-team .team-card__wash{ position:absolute; inset:0; background:linear-gradient(180deg,rgba(15,26,46,.01),rgba(15,26,46,.12)); pointer-events:none; } .hg-team .team-card__logo{ position:absolute; top:7%; left:0; z-index:3; width:100%; height:auto; opacity:0; filter:drop-shadow(0 clamp(4px,1.92cqw,12px) clamp(10px,4.62cqw,28px) rgba(15,26,46,.12)); pointer-events:none; transform-origin:50% 50%; will-change:transform,opacity; } .hg-team .team-card__person{ position:absolute; inset:0; z-index:4; filter:grayscale(.36) saturate(.76) contrast(1.015); pointer-events:none; transform-origin:50% 100%; will-change:transform,filter; } .hg-team .team-card__name{ position:absolute; left:6%; bottom:5.7%; z-index:5; display:flex; align-items:baseline; gap:clamp(4px,2.12cqw,13px); max-width:88%; padding:clamp(6px,2.12cqw,13px) clamp(8px,2.69cqw,17px); overflow:hidden; background:var(--yellow); color:#101010; box-shadow:0 clamp(4px,1.73cqw,10px) clamp(12px,4.62cqw,28px) rgba(15,26,46,.13); will-change:transform,opacity,clip-path; } .hg-team .team-card__name span{ font-size:clamp(9px,3.27cqw,20px); line-height:1.15; font-weight:700; letter-spacing:-.03em; } .hg-team .team-card__name small{ min-width:0; overflow:hidden; text-overflow:ellipsis; font-size:clamp(4.5px,1.54cqw,9px); line-height:1.2; font-weight:700; letter-spacing:.14em; text-transform:uppercase; white-space:nowrap; } .hg-team .team-profile-list{ border-bottom:1px solid var(--border-primary); } .hg-team .team-profile{ position:relative; display:grid; grid-template-columns:minmax(240px,360px) minmax(0,1fr); align-items:center; gap:clamp(44px,7vw,104px); padding-block:clamp(68px,8vw,112px); border-top:1px solid var(--border-primary); scroll-margin-top:112px; } .hg-team .team-profile__portrait{ width:100%; max-width:360px; justify-self:center; } .hg-team .team-profile__content{ min-width:0; min-height:360px; display:flex; flex-direction:column; justify-content:center; padding-block:12px; } .hg-team .team-profile__role{ color:var(--accent-teal); font-size:12px; font-weight:800; letter-spacing:.14em; text-transform:uppercase; } .hg-team .team-profile__name{ margin-top:8px; color:var(--text-primary); font-size:clamp(32px,4vw,48px); font-weight:750; line-height:1.08; letter-spacing:-.035em; } .hg-team .team-profile__bio{ max-width:720px; margin-top:24px; color:var(--text-secondary); font-size:clamp(17px,1.5vw,20px); line-height:1.75; } .hg-team .team-profile__footer{ display:flex; flex-wrap:wrap; align-items:flex-end; justify-content:space-between; gap:28px; margin-top:auto; padding-top:36px; } .hg-team .team-profile__links{ display:flex; flex-wrap:wrap; gap:10px; } .hg-team .team-profile__link{ display:inline-flex; align-items:center; gap:8px; min-height:40px; padding:9px 13px; border:1px solid var(--border-neutral); border-radius:var(--radius-button); color:var(--text-primary); background:transparent; font-size:13px; font-weight:700; text-decoration:none; transition:background-color .2s ease,border-color .2s ease; } .hg-team .team-profile__link:hover{ background:var(--container-bg); border-color:var(--text-tertiary); } .hg-team .team-profile__link:focus-visible{ outline:2px solid var(--text-primary); outline-offset:3px; } .hg-team .team-signature{ flex:0 0 230px; min-height:96px; display:flex; flex-direction:column; justify-content:space-between; gap:14px; padding:13px 15px 11px; border:1px dashed var(--border-neutral); border-radius:12px; background:linear-gradient(145deg,rgba(246,248,250,.82),rgba(255,255,255,.96)); color:var(--text-tertiary); } .hg-team .team-signature__label{ font-size:9px; font-weight:800; letter-spacing:.14em; text-transform:uppercase; } .hg-team .team-signature__hint{ align-self:center; color:var(--text-muted); font-family:"Bradley Hand","Segoe Print",cursive; font-size:13px; font-style:italic; transform:rotate(-2deg); } .hg-team .team-signature__line{ width:100%; border-top:1px solid var(--border-neutral); } @media (max-width:899px){ .hg-team .team-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); column-gap:clamp(10px,3vw,16px); row-gap:clamp(16px,4.5vw,28px); } .hg-team .team-profile{ grid-template-columns:minmax(210px,280px) minmax(0,1fr); gap:clamp(30px,6vw,52px); } .hg-team .team-profile__content{ min-height:310px; } } @media (max-width:699px){ .hg-team .team-profile{ grid-template-columns:1fr; gap:34px; padding-block:58px; } .hg-team .team-profile__portrait{ width:min(72vw,280px); } .hg-team .team-profile__content{ min-height:0; padding:0; } .hg-team .team-profile__bio{ margin-top:18px; } .hg-team .team-profile__footer{ padding-top:28px; } .hg-team .team-signature{ margin-left:auto; } } @media (prefers-reduced-motion:reduce){ .hg-team .team-card__person{ filter:none; } .hg-team .team-card__name{ opacity:1; transform:none; clip-path:none; } .hg-team .team-profile__link{ transition:none; } } `; const CARD_IDLE_SHADOW = "0 18px 48px rgba(17, 18, 15, 0.11)"; const CARD_HOVER_SHADOW = "0 28px 72px rgba(15, 26, 46, 0.18)"; const CTA_CARD_CSS = ".hg-team--cta{width:320px;height:400px;flex:0 0 auto;container-type:inline-size;transform-origin:50% 55%;will-change:transform;}" + ".hg-team--cta .team-card{width:100%;height:100%;aspect-ratio:auto;cursor:default;}" + ".hg-team--cta .team-card__backdrop{filter:grayscale(0) saturate(1) brightness(.9) blur(0);}" + ".hg-team--cta .team-card__person{filter:grayscale(0) saturate(1) contrast(1);}" + ".hg-team--cta .team-card__name{opacity:1;transform:none;clip-path:none;}" + ".hg-team--cta .team-card__name span{font-size:16px;}" + ".hg-team--cta .team-card__name small{font-size:8px;}"; const BACKDROP_IDLE_FILTER = "grayscale(0) saturate(0.93) brightness(0.79) blur(0px)"; const BACKDROP_HOVER_FILTER = "grayscale(0.04) saturate(0.74) brightness(0.73) blur(1.25px)"; const PERSON_IDLE_FILTER = "grayscale(0.36) saturate(0.76) contrast(1.015)"; const PERSON_HOVER_FILTER = "grayscale(0) saturate(1) contrast(1.01)"; const LOGO_ENTRY_ROTATION = -36.4; const LOGO_EXIT_ROTATION = 28.6; const NAME_LINGER_SECONDS = 5; function TeamCardVisual({ member, href, focusable = true, nameLabel, }: { member: Member; href?: string; focusable?: boolean; nameLabel?: string; }) { const content = ( <>
{`Portrait
{nameLabel ?? member.name} {member.cardRole}
); if (href) { return ( {content} ); } return (
{content}
); } function useTeamCardAnimations(rootRef: RefObject) { useEffect(() => { const root = rootRef.current; if (!root) return; gsap.registerPlugin(ScrollTrigger, MotionPathPlugin); gsap.defaults({ overwrite: "auto" }); const media = gsap.matchMedia(); media.add( { isDesktop: "(min-width: 900px) and (hover: hover) and (pointer: fine)", isScrollDriven: "(max-width: 899px), (hover: none), (pointer: coarse)", reduceMotion: "(prefers-reduced-motion: reduce)", }, (context) => { const conditions = context.conditions as { isDesktop: boolean; isScrollDriven: boolean; reduceMotion: boolean; }; if (conditions.reduceMotion) return; const cards = Array.from(root.querySelectorAll(".team-card")); const controllers = cards.map((card) => setupTeamCard(card, { pointerInteractions: conditions.isDesktop }), ); const scrollTriggers = conditions.isScrollDriven ? controllers.map((controller, index) => ScrollTrigger.create({ trigger: cards[index], start: "clamp(top 82%)", end: "clamp(bottom 18%)", onEnter: () => controller.setInView(true), onEnterBack: () => controller.setInView(true), onLeave: () => controller.setInView(false), onLeaveBack: () => controller.setInView(false), }), ) : []; ScrollTrigger.refresh(); return () => { scrollTriggers.forEach((trigger) => trigger.kill()); controllers.forEach((controller) => controller.destroy()); }; }, root, ); return () => media.revert(); }, [rootRef]); } function useTeamProfileReveal(rootRef: RefObject) { useEffect(() => { const root = rootRef.current; if (!root) return; gsap.registerPlugin(ScrollTrigger, MotionPathPlugin); const media = gsap.matchMedia(); media.add( { isCompact: "(max-width: 699px)", isWide: "(min-width: 700px)", reduceMotion: "(prefers-reduced-motion: reduce)", }, (context) => { const conditions = context.conditions as { isCompact: boolean; isWide: boolean; reduceMotion: boolean; }; if (conditions.reduceMotion) return; const distanceScale = conditions.isCompact ? 0.82 : 1; const scaledPath = (points: ReadonlyArray) => points.map(([x, y]) => ({ x: x * distanceScale, y: y * distanceScale })); const profiles = Array.from(root.querySelectorAll(".team-profile")); const timelines = profiles.flatMap((profile, index) => { const portrait = profile.querySelector(".team-profile__portrait"); const role = profile.querySelector(".team-profile__role"); const name = profile.querySelector(".team-profile__name"); const bio = profile.querySelector(".team-profile__bio"); const links = profile.querySelector(".team-profile__links"); const signature = profile.querySelector(".team-signature"); if (!portrait || !role || !name || !bio || !links || !signature) return []; const timeline = gsap.timeline({ scrollTrigger: { trigger: profile, start: "clamp(top 90%)", end: "clamp(bottom 22%)", scrub: 0.5, invalidateOnRefresh: true, refreshPriority: index, }, }); timeline .fromTo( portrait, { autoAlpha: 0, x: -92 * distanceScale, y: -74 * distanceScale, scale: 0.925, rotation: -2.2, }, { motionPath: { path: scaledPath([ [-92, -74], [-78, -18], [-34, 24], [0, 0], ]), curviness: 1.6, fromCurrent: false, }, autoAlpha: 1, scale: 1, rotation: 0, duration: 0.42, ease: "power2.out", }, 0, ) .fromTo( role, { autoAlpha: 0, x: 62 * distanceScale, y: -52 * distanceScale, rotation: 1.2 }, { motionPath: { path: scaledPath([ [62, -52], [54, -10], [20, 14], [0, 0], ]), curviness: 1.6, fromCurrent: false, }, autoAlpha: 1, rotation: 0, duration: 0.38, ease: "power2.out", }, 0.04, ) .fromTo( name, { autoAlpha: 0, x: 100 * distanceScale, y: -72 * distanceScale, rotation: 1.8 }, { motionPath: { path: scaledPath([ [100, -72], [84, -12], [36, 26], [0, 0], ]), curviness: 1.6, fromCurrent: false, }, autoAlpha: 1, rotation: 0, duration: 0.4, ease: "power2.out", }, 0.07, ) .fromTo( bio, { autoAlpha: 0, x: -78 * distanceScale, y: -58 * distanceScale, rotation: -0.8 }, { motionPath: { path: scaledPath([ [-78, -58], [-66, -8], [-28, 22], [0, 0], ]), curviness: 1.6, fromCurrent: false, }, autoAlpha: 1, rotation: 0, duration: 0.38, ease: "power2.out", }, 0.1, ) .fromTo( links, { autoAlpha: 0, x: -66 * distanceScale, y: -44 * distanceScale }, { motionPath: { path: scaledPath([ [-66, -44], [-54, -6], [-22, 18], [0, 0], ]), curviness: 1.6, fromCurrent: false, }, autoAlpha: 1, duration: 0.35, ease: "power2.out", }, 0.13, ) .fromTo( signature, { autoAlpha: 0, x: 82 * distanceScale, y: -60 * distanceScale, rotation: 2.4 }, { motionPath: { path: scaledPath([ [82, -60], [70, -8], [30, 24], [0, 0], ]), curviness: 1.6, fromCurrent: false, }, autoAlpha: 1, rotation: 0, duration: 0.33, ease: "power2.out", }, 0.16, ) .to( role, { motionPath: { path: scaledPath([ [0, 0], [20, 14], [54, -10], [70, -60], ]), curviness: 1.6, fromCurrent: false, }, autoAlpha: 0, rotation: 1.4, duration: 0.4, ease: "power2.in", }, 0.58, ) .to( name, { motionPath: { path: scaledPath([ [0, 0], [36, 26], [88, -12], [108, -78], ]), curviness: 1.6, fromCurrent: false, }, autoAlpha: 0, rotation: 1.8, duration: 0.4, ease: "power2.in", }, 0.6, ) .to( portrait, { motionPath: { path: scaledPath([ [0, 0], [-34, 24], [-80, -18], [-96, -82], ]), curviness: 1.6, fromCurrent: false, }, autoAlpha: 0, scale: 0.93, rotation: -2.2, duration: 0.44, ease: "power2.in", }, 0.6, ) .to( bio, { motionPath: { path: scaledPath([ [0, 0], [-28, 22], [-68, -8], [-84, -66], ]), curviness: 1.6, fromCurrent: false, }, autoAlpha: 0, rotation: -0.8, duration: 0.42, ease: "power2.in", }, 0.6, ) .to( links, { motionPath: { path: scaledPath([ [0, 0], [-22, 18], [-58, -6], [-72, -52], ]), curviness: 1.6, fromCurrent: false, }, autoAlpha: 0, duration: 0.39, ease: "power2.in", }, 0.62, ) .to( signature, { motionPath: { path: scaledPath([ [0, 0], [30, 24], [74, -8], [88, -68], ]), curviness: 1.6, fromCurrent: false, }, autoAlpha: 0, rotation: -2.4, duration: 0.4, ease: "power2.in", }, 0.64, ); return [timeline]; }); ScrollTrigger.refresh(); return () => { timelines.forEach((timeline) => { timeline.scrollTrigger?.kill(); timeline.kill(); }); }; }, root, ); return () => media.revert(); }, [rootRef]); } export default function TeamCards() { const rootRef = useRef(null); useTeamCardAnimations(rootRef); return (
{TEAM_MEMBERS.map((member) => (
))}
); } export function AnimatedDavidCard() { const rootRef = useRef(null); const david = TEAM_MEMBERS.find((member) => member.id === "david")!; useEffect(() => { const root = rootRef.current; if (!root) return; gsap.registerPlugin(ScrollTrigger); const card = root.querySelector(".team-card"); const backdrop = root.querySelector(".team-card__backdrop"); const person = root.querySelector(".team-card__person"); const logo = root.querySelector(".team-card__logo"); const name = root.querySelector(".team-card__name"); if (!card || !backdrop || !person || !logo || !name) return; const media = gsap.matchMedia(); media.add( { motion: "(prefers-reduced-motion: no-preference)", reduceMotion: "(prefers-reduced-motion: reduce)", }, (context) => { gsap.set(card, { autoAlpha: 1, x: 0, y: 0, rotation: 0, boxShadow: CARD_IDLE_SHADOW, }); gsap.set(backdrop, { scale: 1, filter: "grayscale(0) saturate(1) brightness(0.9) blur(0px)", }); gsap.set(person, { y: 0, scale: 1, filter: "grayscale(0) saturate(1) contrast(1)", }); gsap.set(name, { autoAlpha: 1, y: 0, clipPath: "inset(0 0% 0 0)", }); gsap.set(logo, { autoAlpha: 0, scale: 0.45, y: 14, rotation: -32, }); const conditions = context.conditions as { motion: boolean; reduceMotion: boolean; }; if (!conditions.motion || conditions.reduceMotion) return; // The card enters once with the page, while its internal reveal remains // replayable. Keeping those timelines separate prevents hover from // fighting the scroll-triggered card transform. const replayTimeline = gsap.timeline({ paused: true, defaults: { overwrite: "auto" }, }); replayTimeline .fromTo( backdrop, { scale: 0.985, filter: "grayscale(0) saturate(0.96) brightness(0.86) blur(0px)", }, { scale: 1.006, filter: "grayscale(0) saturate(1.04) brightness(0.93) blur(0px)", duration: 0.64, ease: "power3.out", immediateRender: false, }, 0, ) .to( backdrop, { scale: 1, filter: "grayscale(0) saturate(1) brightness(0.9) blur(0px)", duration: 0.46, ease: "power2.out", }, 0.64, ) .fromTo( person, { y: 10, scale: 0.97, filter: "grayscale(0) saturate(0.96) contrast(1)", }, { y: 0, scale: 1.012, filter: "grayscale(0) saturate(1) contrast(1)", duration: 0.72, ease: "power3.out", immediateRender: false, }, 0, ) .to( person, { scale: 1, duration: 0.4, ease: "power2.out", }, 0.7, ) .fromTo( logo, { autoAlpha: 0, scale: 0.45, y: 14, rotation: -32, }, { autoAlpha: 0.62, scale: 1, y: 0, rotation: 0, duration: 0.82, ease: "expo.out", immediateRender: false, }, 0.06, ) .to( logo, { autoAlpha: 0.16, scale: 0.94, y: 4, rotation: 0, duration: 0.54, ease: "power2.out", }, 0.92, ); const entranceTimeline = gsap.timeline({ defaults: { overwrite: "auto" }, scrollTrigger: { trigger: root, start: "clamp(top 84%)", once: true, }, }); entranceTimeline .fromTo( card, { autoAlpha: 0, x: 64, y: 22, rotation: 1.8, boxShadow: "0 10px 28px rgba(17, 18, 15, 0.07)", }, { autoAlpha: 1, x: 0, y: 0, rotation: 0, boxShadow: CARD_IDLE_SHADOW, duration: 0.86, ease: "power3.out", clearProps: "transform,opacity,visibility", }, 0, ) .call(() => { replayTimeline.restart(); }, [], 0.1); // Hover replays the recognisable portrait/logo reveal and adds a small // lift on the wrapper. The scroll entrance keeps sole ownership of the // card transform, so repeated hovers never snap its position. const hoverIn = () => { replayTimeline.restart(); gsap.to(root, { y: -5, scale: 1.01, duration: 0.16, ease: "power2.out", overwrite: "auto", }); }; const hoverOut = () => { gsap.to(root, { y: 0, scale: 1, duration: 0.3, ease: "power3.out", overwrite: "auto", onComplete: () => { gsap.set(root, { clearProps: "transform" }); }, }); }; root.addEventListener("pointerenter", hoverIn); root.addEventListener("pointerleave", hoverOut); return () => { root.removeEventListener("pointerenter", hoverIn); root.removeEventListener("pointerleave", hoverOut); gsap.killTweensOf(root); gsap.set(root, { clearProps: "transform" }); replayTimeline.kill(); entranceTimeline.scrollTrigger?.kill(); entranceTimeline.kill(); }; }, root, ); return () => media.revert(); }, []); return (
); } export function TeamProfiles() { const rootRef = useRef(null); useTeamCardAnimations(rootRef); useTeamProfileReveal(rootRef); return (
MENSCHEN HINTER HIVEGRID

Acht Menschen. Acht Perspektiven.

Jede Person bringt ihren eigenen Blick auf Handwerk, Produkt und Zusammenarbeit mit.

{TEAM_MEMBERS.map((member) => { const profileId = teamProfileId(member.id); const emailHref = `mailto:info@hivegrid.de?subject=${encodeURIComponent(`Kontakt zu ${member.fullName}`)}`; return ( ); })}
); } function SignaturePlaceholder({ name }: { name: string }) { return (
Unterschrift / Skizze Dein Zeichen hier …
); } function setupTeamCard( card: HTMLElement, { pointerInteractions }: { pointerInteractions: boolean }, ) { const backdrop = card.querySelector(".team-card__backdrop"); const person = card.querySelector(".team-card__person"); const logo = card.querySelector(".team-card__logo"); const name = card.querySelector(".team-card__name"); if (!backdrop || !person || !logo || !name) { return { setInView: () => undefined, destroy: () => undefined, }; } let logoTween: gsap.core.Tween | undefined; let nameTween: gsap.core.Tween | undefined; let personColorTween: gsap.core.Tween | undefined; let delayedHide: gsap.core.Tween | undefined; gsap.set(card, { y: 0, boxShadow: CARD_IDLE_SHADOW }); gsap.set(backdrop, { scale: 1, filter: BACKDROP_IDLE_FILTER }); gsap.set(person, { y: 0, scale: 1, filter: PERSON_IDLE_FILTER }); gsap.set(logo, { autoAlpha: 0, scale: 0.4, y: 16, rotation: LOGO_ENTRY_ROTATION }); gsap.set(name, { autoAlpha: 0, y: 9, clipPath: "inset(0 100% 0 0)" }); const depthTimeline = gsap.timeline({ paused: true, defaults: { duration: 0.72, ease: "power3.out", overwrite: "auto" }, }); depthTimeline .to(card, { y: -3, boxShadow: CARD_HOVER_SHADOW }, 0) .to(backdrop, { scale: 1.006, filter: BACKDROP_HOVER_FILTER }, 0) .to(person, { y: 0, scale: 1.022 }, 0); const show = () => { delayedHide?.kill(); logoTween?.kill(); nameTween?.kill(); personColorTween?.kill(); depthTimeline.play(); logoTween = gsap.to(logo, { autoAlpha: 0.64, scale: 1, y: 0, rotation: 0, duration: 1.15, ease: "expo.out", }); personColorTween = gsap.to(person, { filter: PERSON_HOVER_FILTER, duration: 0.62, ease: "power3.out", }); nameTween = gsap.to(name, { autoAlpha: 1, y: 0, clipPath: "inset(0 0% 0 0)", delay: 0.13, duration: 0.5, ease: "power3.out", }); }; const hide = () => { depthTimeline.reverse(); logoTween?.kill(); logoTween = gsap.to(logo, { autoAlpha: 0, scale: 0.4, y: 16, rotation: LOGO_EXIT_ROTATION, duration: 0.62, ease: "power3.in", onComplete: () => { gsap.set(logo, { rotation: LOGO_ENTRY_ROTATION }); }, }); delayedHide?.kill(); delayedHide = gsap.delayedCall(NAME_LINGER_SECONDS, () => { nameTween?.kill(); personColorTween?.kill(); nameTween = gsap.to(name, { autoAlpha: 0, y: 9, clipPath: "inset(0 100% 0 0)", duration: 0.45, ease: "power3.in", }); personColorTween = gsap.to(person, { filter: PERSON_IDLE_FILTER, duration: 0.45, ease: "power3.in", }); }) as unknown as gsap.core.Tween; }; let isHovered = false; let isFocused = false; let isInView = false; let isActive = false; const sync = () => { const shouldBeActive = isHovered || isFocused || isInView; if (shouldBeActive === isActive) return; isActive = shouldBeActive; if (isActive) show(); else hide(); }; const onEnter = () => { isHovered = true; sync(); }; const onLeave = () => { isHovered = false; sync(); }; const onFocus = () => { isFocused = true; sync(); }; const onBlur = () => { isFocused = false; sync(); }; if (pointerInteractions) { card.addEventListener("pointerenter", onEnter); card.addEventListener("pointerleave", onLeave); } card.addEventListener("focus", onFocus); card.addEventListener("blur", onBlur); return { setInView(value: boolean) { isInView = value; sync(); }, destroy() { if (pointerInteractions) { card.removeEventListener("pointerenter", onEnter); card.removeEventListener("pointerleave", onLeave); } card.removeEventListener("focus", onFocus); card.removeEventListener("blur", onBlur); depthTimeline.kill(); logoTween?.kill(); nameTween?.kill(); personColorTween?.kill(); delayedHide?.kill(); }, }; }