{"version":3,"file":"ScrollLogo.CLKC0FGL.mjs","names":["useMemo","useState","useRef","p"],"sources":["https:/framerusercontent.com/modules/xpxmQdnOaWXQGgLjCAZy/q62haERwHHuzJM3qGr3b/ScrollLogo.js"],"sourcesContent":["// ScrollProgressLogo_NoFlash_NoFade.tsx\n// Progress-tied logo with instant swaps (predecode; no crossfade)\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useMemo,useRef,useState}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useScroll,useSpring}from\"framer-motion\";const logoDefaults=[{src:{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Logo 1\"},alt:\"Logo 1\"},{src:{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Logo 2\"},alt:\"Logo 2\"},{src:{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Logo 3\"},alt:\"Logo 3\"},{src:{src:\"https://framerusercontent.com/images/2uTNEj5aTl2K3NJaEFWMbnrA.jpg\",alt:\"Logo 4\"},alt:\"Logo 4\"},{src:{src:\"https://framerusercontent.com/images/f9RiWoNpmlCMqVRIHz8l8wYfeI.jpg\",alt:\"Logo 5\"},alt:\"Logo 5\"},{src:{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Logo 6\"},alt:\"Logo 6\"},{src:{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Logo 7\"},alt:\"Logo 7\"},{src:{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Logo 8\"},alt:\"Logo 8\"},{src:{src:\"https://framerusercontent.com/images/2uTNEj5aTl2K3NJaEFWMbnrA.jpg\",alt:\"Logo 9\"},alt:\"Logo 9\"},{src:{src:\"https://framerusercontent.com/images/f9RiWoNpmlCMqVRIHz8l8wYfeI.jpg\",alt:\"Logo 10\"},alt:\"Logo 10\"},{src:{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Logo 11\"},alt:\"Logo 11\"},{src:{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Logo 12\"},alt:\"Logo 12\"},{src:{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Logo 13\"},alt:\"Logo 13\"}];/**\n * @framerIntrinsicWidth 50\n * @framerIntrinsicHeight 50\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollProgressLogo(props){const{logos=logoDefaults,springStiffness=120,springDamping=20,startOffset=0,// 20% faster: finish sequence at ~83.3% page scroll\nendOffset=.8333}=props;const isStatic=useIsStaticRenderer();const urls=useMemo(()=>logos.map(l=>l?.src?.src||\"\"),[logos]);// frame = target based on scroll; current = what’s actually shown\nconst[frame,setFrame]=useState(0);const[current,setCurrent]=useState(0);// cache of preloaded images\nconst cacheRef=useRef(new Map);// Preload + decode all frames (best experience after warmup)\nuseEffect(()=>{if(isStatic)return;urls.forEach(u=>{if(!u||cacheRef.current.has(u))return;const img=new Image;img.decoding=\"async\";img.loading=\"eager\";img.src=u;img.decode?.().catch(()=>{})// ignore decode errors; browser will still paint when ready\n;cacheRef.current.set(u,img);});},[urls,isStatic]);// Framer smooth progress\nconst{scrollYProgress}=useScroll();const smooth=useSpring(scrollYProgress,{stiffness:springStiffness,damping:springDamping,mass:.2});// Map progress → target frame\nuseEffect(()=>{const clamp=(v,a,b)=>Math.max(a,Math.min(b,v));const unsub=smooth.on(\"change\",p=>{const span=Math.max(1e-4,endOffset-startOffset);const normalized=clamp((p-startOffset)/span,0,1);const idx=Math.min(logos.length-1,Math.floor(normalized*logos.length));setFrame(idx);});return()=>unsub();},[smooth,logos.length,startOffset,endOffset]);// When target frame changes, switch only after the image is decoded (instant swap).\nuseEffect(()=>{if(frame===current)return;const targetUrl=urls[frame];if(!targetUrl)return;const commit=()=>setCurrent(frame);const img=cacheRef.current.get(targetUrl);if(img){if(img.complete){// Some browsers expose decode state; fall back to complete\n// @ts-ignore\nif(img.decode){// try to ensure decode finished; if it rejects, still commit (browser will have it cached)\n// @ts-ignore\nimg.decode().then(commit).catch(commit);}else{commit();}}else{// not complete yet: wait for load or decode\nconst onLoad=()=>{commit();cleanup();};const onError=()=>{commit();cleanup();};const cleanup=()=>{img.removeEventListener(\"load\",onLoad);img.removeEventListener(\"error\",onError);};img.addEventListener(\"load\",onLoad);img.addEventListener(\"error\",onError);}}else{// not in cache (shouldn't happen often): create, decode, then commit\nconst waiter=new Image;waiter.src=targetUrl;waiter.decode?.().then(commit).catch(commit);cacheRef.current.set(targetUrl,waiter);}},[frame,current,urls]);const currentLogo=logos[current]||logoDefaults[0];return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\",background:\"transparent\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",contain:\"content\"},\"aria-label\":\"Logo variant\",children:/*#__PURE__*/_jsx(\"img\",{src:currentLogo.src?.src,alt:currentLogo.alt||currentLogo.src?.alt||\"Logo\",style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"contain\",display:\"block\",background:\"transparent\",contain:\"paint\",pointerEvents:\"none\"},draggable:false,decoding:\"async\",loading:\"eager\",fetchPriority:\"low\"},`current-${currentLogo.src?.src||current}`)});}addPropertyControls(ScrollProgressLogo,{logos:{type:ControlType.Array,title:\"Logos\",control:{type:ControlType.Object,controls:{src:{type:ControlType.ResponsiveImage,title:\"Image\"},alt:{type:ControlType.String,title:\"Alt Text\",defaultValue:\"Logo\"}}},maxCount:48,defaultValue:logoDefaults},springStiffness:{type:ControlType.Number,title:\"Spring Stiffness\",min:40,max:300,defaultValue:120},springDamping:{type:ControlType.Number,title:\"Spring Damping\",min:10,max:40,defaultValue:20},startOffset:{type:ControlType.Number,title:\"Start Offset\",min:0,max:.5,step:.01,defaultValue:0},endOffset:{type:ControlType.Number,title:\"End Offset\",min:.5,max:1,step:.01,// 20% faster by default\ndefaultValue:.8333}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollProgressLogo\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"50\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicHeight\":\"50\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollLogo.map"],"mappings":"qZAOG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,QAAM,EAAa,kBAAgB,IAAI,gBAAc,GAAG,cAAY,EAC/H,YAAU,OAAO,EAAY,EAAS,GAAqB,CAAO,EAAKA,MAAY,EAAM,IAAI,GAAG,GAAG,KAAK,KAAK,GAAG,CAAC,CAAC,EAAM,CAAC,CACpH,CAAC,EAAM,GAAUC,EAAS,EAAE,CAAM,CAAC,EAAQ,GAAYA,EAAS,EAAE,CACjE,EAASC,EAAO,IAAI,IAAI,CAC9B,MAAc,CAAI,GAAgB,EAAK,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,EAAS,QAAQ,IAAI,EAAE,CAAC,OAAO,IAAM,EAAI,IAAI,MAAM,EAAI,SAAS,QAAQ,EAAI,QAAQ,QAAQ,EAAI,IAAI,EAAE,EAAI,UAAU,CAAC,UAAU,GAAG,CAC3L,EAAS,QAAQ,IAAI,EAAE,EAAI,EAAG,EAAG,CAAC,EAAK,EAAS,CAAC,CAClD,GAAK,CAAC,mBAAiB,GAAW,CAAO,EAAO,EAAU,EAAgB,CAAC,UAAU,EAAgB,QAAQ,EAAc,KAAK,GAAG,CAAC,CACpI,MAAc,CAAC,IAAM,GAAO,EAAE,EAAE,IAAI,KAAK,IAAI,E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