{"version":3,"file":"ThreeD.CiYJrRcg.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/t8gbnPCaUBdvIXYQNwo7/PjB6xNaFoD3lC1nmFmQm/ThreeD.js"],"sourcesContent":["// © Framer University. All rights reserved.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{motion,useSpring}from\"framer-motion\";import{useState,useRef,useEffect}from\"react\";// Learn more: https://www.framer.com/docs/guides/overrides/\n//Spring animation parameters\nconst spring={type:\"spring\",stiffness:300,damping:30};/**\n * Based on the code created by Joshua Guo\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export function with3D(Component){return props=>{const[rotateXaxis,setRotateXaxis]=useState(0);const[rotateYaxis,setRotateYaxis]=useState(0);const ref=useRef(null);const handleMouseMove=event=>{const element=ref.current;const elementRect=element.getBoundingClientRect();const elementWidth=elementRect.width;const elementHeight=elementRect.height;const elementCenterX=elementWidth/2;const elementCenterY=elementHeight/2;const mouseX=event.clientY-elementRect.y-elementCenterY;const mouseY=event.clientX-elementRect.x-elementCenterX;const degreeX=mouseX/elementWidth*-20//The number is the rotation factor\n;const degreeY=mouseY/elementHeight*-20//The number is the rotation factor\n;setRotateXaxis(degreeX);setRotateYaxis(degreeY);};const handleMouseEnd=()=>{setRotateXaxis(0);setRotateYaxis(0);};const dx=useSpring(0,spring);const dy=useSpring(0,spring);useEffect(()=>{dx.set(-rotateXaxis);dy.set(rotateYaxis);},[rotateXaxis,rotateYaxis]);return /*#__PURE__*/_jsx(motion.div,{transition:spring,style:{perspective:\"1200px\",transformStyle:\"preserve-3d\",width:`${props.width}`,height:`${props.height}`},children:/*#__PURE__*/_jsx(motion.div,{ref:ref,whileHover:{scale:1.1},onMouseMove:handleMouseMove,onMouseLeave:handleMouseEnd,transition:spring,style:{width:\"100%\",height:\"100%\",rotateX:dx,rotateY:dy},children:/*#__PURE__*/_jsxs(\"div\",{style:{perspective:\"1200px\",transformStyle:\"preserve-3d\",width:\"100%\",height:\"100%\"},children:[/*#__PURE__*/_jsx(motion.div,{transition:spring,style:{width:\"100%\",height:\"100%\",backfaceVisibility:\"hidden\",position:\"absolute\"},children:/*#__PURE__*/_jsx(Component,{...props,variant:\"Front\",style:{width:\"100%\",height:\"100%\"}})}),/*#__PURE__*/_jsx(motion.div,{initial:{rotateY:180},transition:spring,style:{width:\"100%\",height:\"100%\",zIndex:0,backfaceVisibility:\"hidden\",position:\"absolute\"},children:/*#__PURE__*/_jsx(Component,{...props,variant:\"Back\",style:{width:\"100%\",height:\"100%\"}})})]})})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"with3D\":{\"type\":\"reactHoc\",\"name\":\"with3D\",\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ThreeD.map"],"mappings":"0LAQG,SAAgB,EAAO,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAY,GAAgBA,EAAS,EAAE,CAAM,CAAC,EAAY,GAAgBA,EAAS,EAAE,CAAO,EAAIC,EAAO,KAAK,CAAO,EAAgB,GAAO,CAA2B,IAAM,EAAlB,EAAI,QAAkC,uBAAuB,CAAO,EAAa,EAAY,MAAY,EAAc,EAAY,OAAa,EAAe,EAAa,EAAQ,EAAe,EAAc,EAAQ,EAAO,EAAM,QAAQ,EAAY,EAAE,EAAqB,EAAO,EAAM,QAAQ,EAAY,EAAE,EAAqB,EAAQ,EAAO,EAAa,IACjjB,EAAQ,EAAO,EAAc,IACnC,EAAe,EAAQ,CAAC,EAAe,EAAQ,EAAS,MAAmB,CAAC,EAAe,EAAE,CAAC,EAAe,EAAE,EAAS,EAAG,EAAU,EAAE,EAAO,CAAO,EAAG,EAAU,EAAE,EAAO,CAAsF,OAArF,MAAc,CAAC,EAAG,IAAI,CAAC,EAAY,CAAC,EAAG,IAAI,EAAY,EAA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