{"version":3,"file":"CursorShadowText.3ik4eOGv.mjs","names":["useState","useRef","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/VqfaYr6tEG0ZeplaajQw/9Cnmv9cUo4Gkr6CQNayd/CursorShadowText.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef,useCallback,useMemo}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";export default function CursorShadowText(props){const{text,textColor,shadowColors=[\"#1A237E\",\"#7E57C2\",\"#ff005e\",\"#ff9e00\",\"#00e5ff\"],shadowColor1=\"#1A237E\",shadowColor2=\"#7E57C2\",shadowColor3=\"#ff005e\",shadowColor4=\"#ff9e00\",shadowColor5=\"#00e5ff\",shadowCount,shadowDistance,sensitivity,font,shadowEffect,blurAmount,noiseIntensity,glowIntensity,style}=props;const[mousePosition,setMousePosition]=useState({x:0,y:0});const[elementCenter,setElementCenter]=useState({x:0,y:0});const containerRef=useRef(null);// Create active shadow colors using individual color props\nconst activeShadowColors=useMemo(()=>{const individualColors=[shadowColor1,shadowColor2,shadowColor3,shadowColor4,shadowColor5];const colors=[];for(let i=0;i<shadowCount;i++){colors.push(individualColors[i]);}return colors;},[shadowColor1,shadowColor2,shadowColor3,shadowColor4,shadowColor5,shadowCount]);// Memoized mouse move handler\nconst handleMouseMove=useCallback(e=>{setMousePosition({x:e.clientX,y:e.clientY});},[]);// Setup mouse tracking\nuseEffect(()=>{if(typeof window!==\"undefined\"){window.addEventListener(\"mousemove\",handleMouseMove);return()=>window.removeEventListener(\"mousemove\",handleMouseMove);}},[handleMouseMove]);// Update element center position when ref changes\nuseEffect(()=>{if(containerRef.current){const rect=containerRef.current.getBoundingClientRect();setElementCenter({x:rect.left+rect.width/2,y:rect.top+rect.height/2});}},[text,font])// Re-calculate when text or font changes\n;// Memoized shadow positions calculation\nconst shadowPositions=useMemo(()=>{// For static rendering (canvas/thumbnail), use a static shadow position\nif(RenderTarget.current()===RenderTarget.canvas||RenderTarget.current()===RenderTarget.thumbnail){return activeShadowColors.map((color,index)=>{const multiplier=index+1;return{x:shadowDistance*multiplier,y:shadowDistance*multiplier,color};});}// For interactive rendering\nconst deltaX=(mousePosition.x-elementCenter.x)*sensitivity;const deltaY=(mousePosition.y-elementCenter.y)*sensitivity;const clampedX=Math.max(-shadowDistance*2,Math.min(shadowDistance*2,deltaX));const clampedY=Math.max(-shadowDistance*2,Math.min(shadowDistance*2,deltaY));return activeShadowColors.map((color,index)=>{const multiplier=index+1;return{// Default to bottom right position (positive values) when no mouse movement\nx:mousePosition.x===0&&mousePosition.y===0?shadowDistance*multiplier:clampedX*multiplier,y:mousePosition.x===0&&mousePosition.y===0?shadowDistance*multiplier:clampedY*multiplier,color};});},[mousePosition,elementCenter,sensitivity,shadowDistance,activeShadowColors]);// Generate noise filter if needed\nconst noiseFilter=useMemo(()=>{if(shadowEffect!==\"noise\")return null;return /*#__PURE__*/_jsx(\"svg\",{style:{position:\"absolute\",width:0,height:0},children:/*#__PURE__*/_jsxs(\"filter\",{id:\"noise\",children:[/*#__PURE__*/_jsx(\"feTurbulence\",{type:\"fractalNoise\",baseFrequency:noiseIntensity/100,numOctaves:\"3\",result:\"noise\"}),/*#__PURE__*/_jsx(\"feDisplacementMap\",{in:\"SourceGraphic\",in2:\"noise\",scale:noiseIntensity})]})});},[shadowEffect,noiseIntensity]);// Get effect styles for shadows\nconst getEffectStyles=(effect,shadowColor)=>{switch(effect){case\"blur\":return{filter:`blur(${blurAmount}px)`};case\"noise\":return{filter:\"url(#noise)\"};case\"glow\":return{filter:`blur(${glowIntensity}px)`};case\"solid\":default:return{};}};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{...style,display:\"flex\",justifyContent:\"center\",alignItems:\"center\",width:\"100%\",height:\"100%\",position:\"relative\"},children:[noiseFilter,shadowPositions.map((shadow,index)=>/*#__PURE__*/_jsx(motion.h1,{style:{position:\"absolute\",color:shadow.color,margin:0,userSelect:\"none\",transform:`translate(${shadow.x}px, ${shadow.y}px)`,zIndex:shadowPositions.length-index,...font,...getEffectStyles(shadowEffect,shadow.color)},transition:{transform:{type:\"spring\",stiffness:300,damping:30}},children:text},index)),/*#__PURE__*/_jsx(motion.h1,{style:{position:\"relative\",color:textColor,margin:0,userSelect:\"none\",zIndex:shadowPositions.length+1,...font},children:text})]});}// Default props\nCursorShadowText.defaultProps={text:\"MOVE WITH ME\",textColor:\"#ffffff\",shadowColors:[\"#1A237E\",\"#7E57C2\"],shadowColor1:\"#1A237E\",shadowColor2:\"#7E57C2\",shadowColor3:\"#ff005e\",shadowColor4:\"#ff9e00\",shadowColor5:\"#00e5ff\",shadowCount:2,shadowDistance:2,sensitivity:.1,shadowEffect:\"solid\",blurAmount:5,noiseIntensity:10,glowIntensity:8};// Property controls with dynamic color visibility\naddPropertyControls(CursorShadowText,{text:{type:ControlType.String,title:\"Text\",placeholder:\"Enter text...\",defaultValue:\"MOVE WITH ME\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#ffffff\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"64px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1em\"}},shadowEffect:{type:ControlType.Enum,title:\"Shadow Effect\",options:[\"solid\",\"blur\",\"noise\",\"glow\"],optionTitles:[\"Solid\",\"Blur\",\"Noise\",\"Glow\"],defaultValue:\"solid\"},blurAmount:{type:ControlType.Number,title:\"Blur Amount\",min:0,max:20,step:1,defaultValue:5,unit:\"px\",displayStepper:true,hidden:({shadowEffect})=>shadowEffect!==\"blur\"},noiseIntensity:{type:ControlType.Number,title:\"Noise Intensity\",min:1,max:50,step:1,defaultValue:10,displayStepper:true,hidden:({shadowEffect})=>shadowEffect!==\"noise\"},glowIntensity:{type:ControlType.Number,title:\"Glow Intensity\",min:1,max:30,step:1,defaultValue:8,unit:\"px\",displayStepper:true,hidden:({shadowEffect})=>shadowEffect!==\"glow\"},shadowCount:{type:ControlType.Number,title:\"Shadow Count\",min:0,max:5,step:1,defaultValue:2,displayStepper:true},// Group all shadow colors under a section\nshadowColor1:{type:ControlType.Color,title:\"Color 1\",defaultValue:\"#1A237E\",hidden:({shadowCount})=>shadowCount<1},shadowColor2:{type:ControlType.Color,title:\"Color 2\",defaultValue:\"#7E57C2\",hidden:({shadowCount})=>shadowCount<2},shadowColor3:{type:ControlType.Color,title:\"Color 3\",defaultValue:\"#ff005e\",hidden:({shadowCount})=>shadowCount<3},shadowColor4:{type:ControlType.Color,title:\"Color 4\",defaultValue:\"#ff9e00\",hidden:({shadowCount})=>shadowCount<4},shadowColor5:{type:ControlType.Color,title:\"Color 5\",defaultValue:\"#00e5ff\",hidden:({shadowCount})=>shadowCount<5},shadowDistance:{type:ControlType.Number,title:\"Shadow Distance\",min:1,max:50,step:1,defaultValue:3,unit:\"px\",displayStepper:true},sensitivity:{type:ControlType.Number,title:\"Mouse Sensitivity\",min:.01,max:.5,step:.01,defaultValue:.1,description:\"Controls how responsive shadows are to cursor movement\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CursorShadowText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CursorShadowText.map"],"mappings":"8QAA6N,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,OAAK,YAAU,eAAa,CAAC,UAAU,UAAU,UAAU,UAAU,UAAU,CAAC,eAAa,UAAU,eAAa,UAAU,eAAa,UAAU,eAAa,UAAU,eAAa,UAAU,cAAY,iBAAe,cAAY,OAAK,eAAa,aAAW,iBAAe,gBAAc,SAAO,EAAW,CAAC,EAAc,GAAkBA,EAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAM,CAAC,EAAc,GAAkBA,EAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAO,EAAaC,EA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