{"version":3,"file":"Rotating_Text_Pro.BlntLGiB.mjs","names":["useState","useRef","useMemo","useLayoutEffect","useEffect"],"sources":["https:/framerusercontent.com/modules/rfETBacSiIlMz89rTMds/nR9CnwUi02EJn3uaTXD1/Rotating_Text_Pro.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useLayoutEffect,useMemo,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";const useIsomorphicLayoutEffect=typeof window!==\"undefined\"?useLayoutEffect:useEffect;// ─── Animation variant builder ────────────────────────────────────────────────\nfunction buildVariants(animationType,isVertical,enterTransition,exitTransition){switch(animationType){case\"Gravity\":return{needsPerspective:false,initial:{y:\"-100%\",opacity:0,rotate:isVertical?-6:6,scale:.88},enterVariant:{y:\"0%\",opacity:1,rotate:0,scale:1,transition:enterTransition},exitVariant:{y:\"100%\",opacity:0,rotate:isVertical?6:-6,scale:.88,transition:exitTransition}};case\"Blur Rise\":return{needsPerspective:false,initial:{y:\"40%\",filter:\"blur(14px)\",opacity:0,scale:.92},enterVariant:{y:\"0%\",filter:\"blur(0px)\",opacity:1,scale:1,transition:enterTransition},exitVariant:{y:\"-40%\",filter:\"blur(14px)\",opacity:0,scale:.92,transition:exitTransition}};case\"Blur Zoom\":return{needsPerspective:false,initial:{scale:.6,filter:\"blur(20px)\",opacity:0},enterVariant:{scale:1,filter:\"blur(0px)\",opacity:1,transition:enterTransition},exitVariant:{scale:1.4,filter:\"blur(20px)\",opacity:0,transition:exitTransition}};case\"Flip\":return{needsPerspective:true,initial:isVertical?{rotateX:90,opacity:0,scale:.9}:{rotateY:-90,opacity:0,scale:.9},enterVariant:{rotateX:0,rotateY:0,opacity:1,scale:1,transition:enterTransition},exitVariant:isVertical?{rotateX:-90,opacity:0,scale:.9,transition:exitTransition}:{rotateY:90,opacity:0,scale:.9,transition:exitTransition}};case\"Slide\":return{needsPerspective:false,initial:isVertical?{y:\"50%\",x:\"0%\",opacity:0}:{x:\"50%\",y:\"0%\",opacity:0},enterVariant:{y:\"0%\",x:\"0%\",opacity:1,transition:enterTransition},exitVariant:{...isVertical?{y:\"-50%\",x:\"0%\"}:{x:\"-50%\",y:\"0%\"},opacity:0,transition:exitTransition}};case\"Cross Fade\":return{needsPerspective:false,initial:{opacity:0},enterVariant:{opacity:1,transition:enterTransition},exitVariant:{opacity:0,transition:exitTransition}};case\"Drift\":return{needsPerspective:false,initial:{y:\"18%\",opacity:0},enterVariant:{y:\"0%\",opacity:1,transition:enterTransition},exitVariant:{y:\"-18%\",opacity:0,transition:exitTransition}};default:return{needsPerspective:false,initial:{y:\"-100%\",opacity:0,rotate:isVertical?-6:6,scale:.88},enterVariant:{y:\"0%\",opacity:1,rotate:0,scale:1,transition:enterTransition},exitVariant:{y:\"100%\",opacity:0,rotate:isVertical?6:-6,scale:.88,transition:exitTransition}};}}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function RotatingTextPro(props){const{beforeText,rotatingWords,afterText,highlightColor,textColor,font,textAlign,stepDuration,wordTransition,animationType,animationDirection,headingTag,style}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[currentIndex,setCurrentIndex]=useState(0);const[wrapperWidth,setWrapperWidth]=useState(\"auto\");const measureRef=useRef(null);const wordsArray=useMemo(()=>(rotatingWords||\"\").split(\",\").map(w=>w.trim()).filter(Boolean),[rotatingWords]);useIsomorphicLayoutEffect(()=>{if(isCanvas)return;if(measureRef.current){setWrapperWidth(measureRef.current.getBoundingClientRect().width);}},[currentIndex,wordsArray,isCanvas,font]);useEffect(()=>{if(isCanvas||wordsArray.length<=1)return;const timer=setInterval(()=>{setCurrentIndex(prev=>(prev+1)%wordsArray.length);},stepDuration*1e3);return()=>clearInterval(timer);},[isCanvas,stepDuration,wordsArray.length]);const currentWord=wordsArray[currentIndex]||\"\";const firstWord=wordsArray[0]||\"\";const isVertical=animationDirection===\"Vertical\";const enterTransition={...wordTransition,delay:(wordTransition?.delay??0)+.05};const exitTransition={...wordTransition,delay:0};const{needsPerspective,initial,enterVariant,exitVariant}=buildVariants(animationType,isVertical,enterTransition,exitTransition);const Tag=headingTag||\"h1\";return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",...style},children:/*#__PURE__*/_jsxs(Tag,{style:{margin:0,padding:0,color:textColor,textAlign,lineHeight:1.1,letterSpacing:\"-0.02em\",...font},children:[beforeText?`${beforeText} `:\"\",/*#__PURE__*/_jsxs(motion.span,{initial:false,animate:{width:isCanvas?\"auto\":wrapperWidth},transition:enterTransition,style:{color:highlightColor,display:\"inline-block\",position:\"relative\",overflow:\"visible\",verticalAlign:\"bottom\",...needsPerspective?{perspective:\"600px\",perspectiveOrigin:\"50% 50%\"}:{}},children:[!isCanvas&&/*#__PURE__*/_jsx(\"span\",{ref:measureRef,style:{visibility:\"hidden\",pointerEvents:\"none\",display:\"inline-block\",whiteSpace:\"nowrap\",position:\"absolute\",left:0,top:0},children:currentWord}),/*#__PURE__*/_jsx(\"span\",{style:{visibility:isCanvas?\"visible\":\"hidden\",pointerEvents:\"none\",display:\"inline-block\",whiteSpace:\"nowrap\"},children:isCanvas?firstWord:currentWord}),!isCanvas&&/*#__PURE__*/_jsx(AnimatePresence,{initial:false,children:currentWord&&/*#__PURE__*/_jsx(motion.span,{variants:{enter:enterVariant,exit:exitVariant},initial:initial,animate:\"enter\",exit:\"exit\",style:{position:\"absolute\",left:0,top:0,width:\"100%\",display:\"flex\",justifyContent:textAlign===\"left\"?\"flex-start\":textAlign===\"right\"?\"flex-end\":\"center\",willChange:\"transform, opacity, filter\",transformStyle:needsPerspective?\"preserve-3d\":\"flat\"},children:/*#__PURE__*/_jsx(\"span\",{style:{whiteSpace:\"nowrap\"},children:currentWord})},currentIndex)})]}),afterText?` ${afterText}`:\"\"]})});}RotatingTextPro.defaultProps={beforeText:\"Built for\",rotatingWords:\"founders, designers, studios, agencies, builders\",afterText:\"who refuse to ship average.\",highlightColor:\"#33de96\",textColor:\"#0a0a0a\",font:{fontFamily:\"'Instrument Sans', sans-serif\",fontWeight:\"500\",fontStyle:\"normal\",fontSize:\"4.2rem\",lineHeight:\"1.1em\",letterSpacing:\"0em\"},textAlign:\"center\",headingTag:\"h1\",animationType:\"Gravity\",animationDirection:\"Vertical\",stepDuration:1.75,wordTransition:{type:\"tween\",duration:.7,ease:[.76,0,.04,1]}};addPropertyControls(RotatingTextPro,{beforeText:{type:ControlType.String,title:\"Before\",defaultValue:\"Built for\",placeholder:\"Text before rotating word\"},rotatingWords:{type:ControlType.String,title:\"Rotating Words\",defaultValue:\"founders, designers, studios, agencies, builders\",displayTextArea:true,description:\"Comma-separated list of words to cycle through. The wrapper size scales to fit the current word automatically.\"},afterText:{type:ControlType.String,title:\"After\",defaultValue:\"who refuse to ship average.\",displayTextArea:true,placeholder:\"Text after rotating word\"},highlightColor:{type:ControlType.Color,title:\"Highlight\",defaultValue:\"#33de96\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#0a0a0a\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",displayFontSize:true,displayTextAlignment:false,defaultValue:{variant:\"Medium\"}},textAlign:{type:ControlType.Enum,title:\"Align\",defaultValue:\"center\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],displaySegmentedControl:true},headingTag:{type:ControlType.Enum,title:\"Tag\",defaultValue:\"h1\",options:[\"h1\",\"h2\",\"h3\",\"h4\",\"p\"],optionTitles:[\"H1\",\"H2\",\"H3\",\"H4\",\"P\"],displaySegmentedControl:true},animationType:{type:ControlType.Enum,title:\"Animation\",defaultValue:\"Gravity\",displaySegmentedControl:true,segmentedControlDirection:\"vertical\",options:[\"Gravity\",\"Blur Rise\",\"Blur Zoom\",\"Flip\",\"Slide\",\"Cross Fade\",\"Drift\"],optionTitles:[\"Gravity\",\"Blur Rise\",\"Blur Zoom\",\"Flip\",\"Slide\",\"Cross Fade\",\"Drift\"]},animationDirection:{type:ControlType.Enum,title:\"Direction\",defaultValue:\"Vertical\",options:[\"Vertical\",\"Horizontal\"],displaySegmentedControl:true,hidden(props){return props.animationType!==\"Slide\"&&props.animationType!==\"Flip\"&&props.animationType!==\"Gravity\";}},stepDuration:{type:ControlType.Number,title:\"Step Duration\",defaultValue:1.75,min:.5,max:10,step:.25,unit:\"s\",description:\"Time each word holds before rotating\"},wordTransition:{type:ControlType.Transition,title:\"Word Transition\",defaultValue:{type:\"tween\",duration:.7,ease:[.76,0,.04,1]},description:\"Explore [more components](https://dub.sh/daniyal-framer)\\nMade by [Daniyal](https://dub.sh/daniyal-threads)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RotatingTextPro\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Rotating_Text_Pro.map"],"mappings":"sRACA,SAAS,EAAc,EAAc,EAAW,EAAgB,EAAe,CAAC,OAAO,EAAP,CAAsB,IAAI,UAAU,MAAM,CAAC,iBAAiB,GAAM,QAAQ,CAAC,EAAE,QAAQ,QAAQ,EAAE,OAAO,EAAW,GAAG,EAAE,MAAM,GAAG,EAAE,aAAa,CAAC,EAAE,KAAK,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAe,EAAE,YAAY,CAAC,EAAE,OAAO,QAAQ,EAAE,OAAO,EAAW,EAAE,GAAG,MAAM,IAAI,WAAW,CAAc,CAAC,EAAE,IAAI,YAAY,MAAM,CAAC,iBAAiB,GAAM,QAAQ,CAAC,EAAE,MAAM,OAAO,aAAa,QAAQ,EAAE,MAAM,GAAG,EAAE,aAAa,CAAC,EAAE,KAAK,OAAO,YAAY,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAe,EAAE,YAAY,CAAC,EA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