{"version":3,"file":"TiltCard.D58TrDn2.mjs","names":["useRef","useState","useCallback"],"sources":["https:/framerusercontent.com/modules/TOvOo4MhB9AzK4XRHfuH/RQQ8hMTmMHlMfvkNlNi4/TiltCard.js"],"sourcesContent":["// 3D tilt card with editable image, tilts based on cursor, includes shadow in transform\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef,useState,useCallback,startTransition,useEffect}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * 3D Tilt Card with Editable Image\n *\n * @framerIntrinsicWidth 320\n * @framerIntrinsicHeight 200\n *  @framerDisableUnlink\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function TiltCard(props){const{image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},shadowColor,shadowBlur,shadowSpread,borderRadius,maxTilt,borderStyle,borderWidth,borderColor,style}=props;const cardRef=useRef(null);const[tilt,setTilt]=useState({x:0,y:0});const[hovered,setHovered]=useState(false);const[primaryColor,setPrimaryColor]=useState(null);const isStatic=useIsStaticRenderer();const handleMouseMove=useCallback(e=>{if(!cardRef.current)return;const rect=cardRef.current.getBoundingClientRect();const x=e.clientX-rect.left;const y=e.clientY-rect.top;// Responsive: use min(rect.width, rect.height) for normalization\nconst normX=(x-rect.width/2)/(Math.min(rect.width,rect.height)/2);const normY=(y-rect.height/2)/(Math.min(rect.width,rect.height)/2);const clampedX=Math.max(-1,Math.min(1,normX));const clampedY=Math.max(-1,Math.min(1,normY));setTilt({x:clampedY*maxTilt,y:-clampedX*maxTilt});},[maxTilt]);const handleMouseLeave=useCallback(()=>{startTransition(()=>setTilt({x:0,y:0}));startTransition(()=>setHovered(false));},[]);const handleMouseEnter=useCallback(()=>{startTransition(()=>setHovered(true));},[]);// Shadow moves with tilt\nconst shadowX=tilt.y*1.5;const shadowY=tilt.x*1.5;// Glow effect: use 0 offset, large blur, colored shadow\n// Use the dominant color of the image as the glow color if possible\nlet glowColor=primaryColor||shadowColor;useEffect(()=>{if(!image||!image.src){setPrimaryColor(null);return;}// Try to extract dominant color from image\nconst img=new window.Image;img.crossOrigin=\"Anonymous\";img.src=image.src;img.onload=function(){try{const canvas=document.createElement(\"canvas\");canvas.width=img.naturalWidth;canvas.height=img.naturalHeight;const ctx=canvas.getContext(\"2d\");if(!ctx)return;ctx.drawImage(img,0,0);const data=ctx.getImageData(0,0,canvas.width,canvas.height).data;let r=0,g=0,b=0,count=0;for(let i=0;i<data.length;i+=4*20){// sample every 20th pixel\nr+=data[i];g+=data[i+1];b+=data[i+2];count++;}if(count>0){r=Math.round(r/count);g=Math.round(g/count);b=Math.round(b/count);setPrimaryColor(`rgba(${r},${g},${b},0.7)`);}}catch(e){setPrimaryColor(null);}};img.onerror=function(){setPrimaryColor(null);};},[image?.src]);const glow=`0px 0px ${shadowBlur+16}px ${shadowSpread+8}px ${glowColor}`;// Subtle glow following the cursor\nconst[glowPos,setGlowPos]=useState(null);const handleGlowMove=useCallback(e=>{if(!cardRef.current)return;const rect=cardRef.current.getBoundingClientRect();const x=e.clientX-rect.left;const y=e.clientY-rect.top;setGlowPos({x,y});},[]);const handleGlowLeave=useCallback(()=>{setGlowPos(null);},[]);return /*#__PURE__*/_jsx(\"div\",{ref:cardRef,style:{...style,width:\"100%\",height:\"100%\",perspective:1e3,borderRadius,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",background:\"transparent\"},onMouseMove:isStatic?undefined:e=>{handleMouseMove(e);handleGlowMove(e);},onMouseLeave:isStatic?undefined:()=>{handleMouseLeave();handleGlowLeave();},onMouseEnter:isStatic?undefined:handleMouseEnter,tabIndex:0,\"aria-label\":\"3D tilt card\",children:/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",borderRadius,// Use glow instead of boxShadow\nboxShadow:glow,background:\"#fff\",transform:isStatic?undefined:`rotateX(${tilt.x}deg) rotateY(${tilt.y}deg)`,transition:isStatic?undefined:hovered?\"box-shadow 0.2s, transform 0.1s\":\"box-shadow 0.3s, transform 0.3s\",overflow:\"hidden\",willChange:\"transform, box-shadow\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",position:\"relative\",borderStyle,borderWidth:borderWidth+\"px\",borderColor},children:[glowPos&&/*#__PURE__*/_jsx(\"div\",{style:{pointerEvents:\"none\",position:\"absolute\",left:0,top:0,width:\"100%\",height:\"100%\",borderRadius,background:`radial-gradient(circle at ${glowPos.x}px ${glowPos.y}px, ${glowColor} 0%, transparent 60%)`,opacity:.35,transition:\"background 0.15s\",zIndex:2},\"aria-hidden\":\"true\"}),/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",borderRadius,pointerEvents:\"none\",userSelect:\"none\",display:\"block\",position:\"relative\",zIndex:1,maskImage:`radial-gradient(ellipse 100% 100% at center, black ${100-props.edgeBlur}%, transparent 100%)`,WebkitMaskImage:`radial-gradient(ellipse 100% 100% at center, black ${100-props.edgeBlur}%, transparent 100%)`},draggable:false})]})});}addPropertyControls(TiltCard,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},shadowColor:{type:ControlType.Color,title:\"Shadow Color\",defaultValue:\"#22222288\"},shadowBlur:{type:ControlType.Number,title:\"Shadow Blur\",defaultValue:32,min:0,max:64,step:1,unit:\"px\"},shadowSpread:{type:ControlType.Number,title:\"Shadow Spread\",defaultValue:0,min:-16,max:32,step:1,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:16,min:0,max:64,step:1,unit:\"px\"},maxTilt:{type:ControlType.Number,title:\"Max Tilt\",defaultValue:18,min:2,max:45,step:1,unit:\"deg\"},edgeBlur:{type:ControlType.Number,title:\"Edge Blur\",defaultValue:10,min:0,max:50,step:1,unit:\"%\"},borderStyle:{type:ControlType.Enum,title:\"Border Style\",options:[\"solid\",\"dashed\",\"dotted\",\"double\"],optionTitles:[\"Solid\",\"Dashed\",\"Dotted\",\"Double\"],defaultValue:\"solid\"},borderWidth:{type:ControlType.Number,title:\"Border Width\",defaultValue:0,min:0,max:12,step:1,unit:\"px\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#EEEEEE\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TiltCard\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"200\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth any-prefer-fixed\",\"framerIntrinsicWidth\":\"320\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TiltCard.map"],"mappings":"yWASG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,IAAI,sEAAsE,IAAI,oBAAoB,CAAC,cAAY,aAAW,eAAa,eAAa,UAAQ,cAAY,cAAY,cAAY,SAAO,EAAY,EAAQA,EAAO,KAAK,CAAM,CAAC,EAAK,GAASC,EAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAAM,CAAC,EAAa,GAAiBA,EAAS,KAAK,CAAO,EAAS,GAAqB,CAAO,EAAgBC,EAAY,GAAG,CAAC,GAAG,CAAC,EAAQ,QAAQ,OAAO,IAAM,EAAK,EAAQ,QAAQ,uBAAuB,CAAO,EAAE,EAAE,QAAQ,EAAK,KAAW,EAAE,EAAE,QAAQ,EAAK,IAC3mB,GAAO,EAAE,EAAK,MAAM,IAAI,KAAK,IAAI,EAAK,MAAM,EAAK,OAAO,CAAC,GAAS,GAAO,EAAE,EAAK,OAAO,IAAI,KAAK,IAAI,EAAK,MAAM,EAAK,OAAO,CAAC,GAAS,EAAS,KAAK,IAAI,GAAG,KAAK,IAAI,EAAE,EAAM,CAAC,CAA+C,EAAQ,CAAC,EAAxC,KAAK,I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