{"version":3,"file":"ProjectCard.CaT7mYS1.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/2PFFYDTpJWEMakgbWljx/obIm2XUk3DKzYARgjpi7/ProjectCard.js"],"sourcesContent":["// Reusable project card: cover image + title + type.\n// The cover reveals with a pixelation effect when scrolled into view, and on hover\n// the cover scales up inside its clipped frame — the card itself stays put.\n//\n// STAGGER: a module-level scheduler (shared by every ProjectCard instance on the\n// page) starts each card's reveal `revealStagger` seconds after the previous one,\n// instead of all animating at once. That removes the load-time lag while keeping\n// these as native Framer layers (so their parent Stack's link still drives real\n// Framer navigation + page transitions). Each card paints its coarse pixelated\n// placeholder immediately; only the sharpen animation is staggered.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";import{useEffect,useRef}from\"react\";// Shared across all instances on the page. Persists across SPA navigations, but\n// since its value is always in the past after a nav, the next page's first card\n// starts immediately (slot = max(now, oldStart + stagger) = now).\nlet lastRevealStart=0;function scheduleReveal(start,staggerMs){const now=Date.now();const slot=Math.max(now,lastRevealStart+staggerMs);lastRevealStart=slot;const delay=slot-now;if(delay<=0)start();else setTimeout(start,delay);}/**\n * Project Card\n *\n * @framerIntrinsicWidth 480\n * @framerIntrinsicHeight 540\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function ProjectCard(props){const{src=\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",title=\"Project\",kind=\"Category\",aspectRatio=1.2,radius=8,hoverScale=1.06,revealDuration=1,revealSteps=5,revealStagger=.25,style}=props;const isStatic=useIsStaticRenderer();const isFilledWidth=style&&style.width===\"100%\";const frameRef=useRef(null);const canvasRef=useRef(null);const inView=useInView(frameRef,{once:true,margin:\"-8%\"});const enqueuedRef=useRef(false);const stateRef=useRef({disposed:false,loaded:false,done:false,raf:0,render:()=>{},loadPromise:Promise.resolve(),resolveLoad:null});// Set up the image + canvas renderer once per source; paints the coarse\n// pixelated placeholder as soon as the image loads (no animation yet).\nuseEffect(()=>{if(isStatic)return;const st=stateRef.current;st.disposed=false;st.loaded=false;st.done=false;st.loadPromise=new Promise(res=>{st.resolveLoad=res;});const frame=frameRef.current;const canvas=canvasRef.current;if(!frame||!canvas)return;const ctx=canvas.getContext(\"2d\");const off=document.createElement(\"canvas\");const offCtx=off.getContext(\"2d\");if(!ctx||!offCtx)return;const img=new Image;img.crossOrigin=\"anonymous\";const cover=(iw,ih,cw,ch)=>{const ir=iw/ih;const cr=cw/ch;let sw,sh,sx,sy;if(ir>cr){sh=ih;sw=ih*cr;sx=(iw-sw)/2;sy=0;}else{sw=iw;sh=iw/cr;sx=0;sy=(ih-sh)/2;}return{sx,sy,sw,sh};};const render=level=>{const cw=frame.clientWidth;const ch=frame.clientHeight;if(!cw||!ch||!st.loaded)return;const dpr=Math.min(window.devicePixelRatio||1,2);const W=Math.round(cw*dpr);const H=Math.round(ch*dpr);if(canvas.width!==W)canvas.width=W;if(canvas.height!==H)canvas.height=H;canvas.style.width=cw+\"px\";canvas.style.height=ch+\"px\";const{sx,sy,sw,sh}=cover(img.width,img.height,cw,ch);if(level>=1){ctx.imageSmoothingEnabled=true;ctx.clearRect(0,0,W,H);ctx.drawImage(img,sx,sy,sw,sh,0,0,W,H);return;}// coarse -> fine: number of horizontal blocks grows with level\nconst minBlocks=16;const bx=Math.max(minBlocks,Math.round(minBlocks+(W-minBlocks)*level));const by=Math.max(1,Math.round(bx*(ch/cw)));off.width=bx;off.height=by;offCtx.imageSmoothingEnabled=true;offCtx.clearRect(0,0,bx,by);offCtx.drawImage(img,sx,sy,sw,sh,0,0,bx,by);ctx.imageSmoothingEnabled=false;ctx.clearRect(0,0,W,H);ctx.drawImage(off,0,0,bx,by,0,0,W,H);};st.render=render;img.onload=()=>{st.loaded=true;render(st.done?1:0);if(st.resolveLoad)st.resolveLoad();};img.src=src;const onResize=()=>render(st.done?1:0);window.addEventListener(\"resize\",onResize);return()=>{st.disposed=true;cancelAnimationFrame(st.raf);window.removeEventListener(\"resize\",onResize);if(st.resolveLoad)st.resolveLoad();};},[src,isStatic]);// When scrolled into view, join the shared staggered reveal schedule once.\nuseEffect(()=>{if(isStatic||!inView||enqueuedRef.current)return;enqueuedRef.current=true;const animate=()=>{const st=stateRef.current;if(st.disposed||st.done)return;let startTime=0;const tick=ts=>{if(st.disposed)return;if(!startTime)startTime=ts;const elapsed=(ts-startTime)/1e3;const t=revealDuration>0?Math.min(elapsed/revealDuration,1):1;const q=revealSteps>0?Math.floor(t*revealSteps+1e-6)/revealSteps:t;st.render(Math.min(q,1));if(t<1)st.raf=requestAnimationFrame(tick);else{st.render(1);st.done=true;}};st.raf=requestAnimationFrame(tick);};const start=()=>{const st=stateRef.current;if(st.disposed||st.done)return;if(st.loaded)animate();else st.loadPromise.then(animate);};scheduleReveal(start,Math.max(0,revealStagger)*1e3);},[inView,isStatic,revealDuration,revealSteps,revealStagger]);const labelBase={fontFamily:\"'Funnel Sans', sans-serif\",color:\"rgb(236, 232, 223)\",letterSpacing:\"-0.02em\",lineHeight:\"1.2em\",textTransform:\"lowercase\",margin:0};return /*#__PURE__*/_jsxs(motion.div,{style:{position:\"relative\",display:\"flex\",flexDirection:\"column\",gap:16,width:isFilledWidth?\"100%\":480,...style},initial:\"rest\",animate:\"rest\",whileHover:\"hover\",children:[/*#__PURE__*/_jsx(\"div\",{ref:frameRef,style:{position:\"relative\",width:\"100%\",aspectRatio:String(aspectRatio),borderRadius:radius,overflow:\"hidden\"},children:/*#__PURE__*/_jsx(motion.div,{style:{width:\"100%\",height:\"100%\"},variants:{rest:{scale:1},hover:{scale:isStatic?1:hoverScale}},transition:{type:\"spring\",stiffness:300,damping:26},children:isStatic?/*#__PURE__*/_jsx(\"img\",{src:src,alt:title,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}}):/*#__PURE__*/_jsx(\"canvas\",{ref:canvasRef,style:{width:\"100%\",height:\"100%\",display:\"block\"}})})}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:4},children:[/*#__PURE__*/_jsx(\"p\",{style:{...labelBase,fontSize:\"24px\",fontWeight:500},children:title}),/*#__PURE__*/_jsx(\"p\",{style:{...labelBase,fontSize:\"16px\",fontWeight:400,opacity:.6},children:kind})]})]});}addPropertyControls(ProjectCard,{src:{type:ControlType.String,title:\"Cover URL\",defaultValue:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"Project\"},kind:{type:ControlType.String,title:\"Type\",defaultValue:\"Category\"},aspectRatio:{type:ControlType.Number,title:\"Aspect\",defaultValue:1.2,min:.5,max:2,step:.001},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:40},hoverScale:{type:ControlType.Number,title:\"Hover Zoom\",defaultValue:1.06,min:1,max:1.3,step:.01},revealDuration:{type:ControlType.Number,title:\"Reveal Time\",defaultValue:1,min:0,max:4,step:.1},revealSteps:{type:ControlType.Number,title:\"Reveal Steps\",defaultValue:5,min:1,max:20,step:1},revealStagger:{type:ControlType.Number,title:\"Reveal Stagger\",defaultValue:.25,min:0,max:1,step:.05,unit:\"s\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ProjectCard\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"540\",\"framerIntrinsicWidth\":\"480\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProjectCard.map"],"mappings":"qQAasB,SAAS,EAAe,EAAM,EAAU,CAAC,IAAM,EAAI,KAAK,IAAI,EAAQ,EAAK,KAAK,IAAI,EAAI,EAAgB,CAAS,EAAE,EAAgB,EAAK,IAAM,E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