{"version":3,"file":"RollingText.luOWRTb0.mjs","names":["useState","startTransition"],"sources":["https:/framerusercontent.com/modules/c5eCHaqT1Rs0lpu8BQgA/8sQVLQih9E1IE6XIHecf/RollingText.js"],"sourcesContent":["// Rolling hover effect for text layers where each letter moves up/down in a staggered way\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{motion}from\"framer-motion\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function RollingText(props){const{text=\"HOVER ME\",direction=\"up\",staggerDelay=.03,animationDuration=.4,textColor=\"#000000\",hoverColor=\"#0099FF\",font,textAlign=\"left\",verticalAlign=\"center\",padding=\"0px\",textTransform=\"none\",style}=props;const[isHovered,setIsHovered]=useState(false);const letters=text.split(\"\");const isFixedWidth=style?.width===\"100%\";const isFixedHeight=style?.height===\"100%\";const justifyContent=textAlign===\"left\"?\"flex-start\":textAlign===\"right\"?\"flex-end\":\"center\";const alignItems=verticalAlign===\"top\"?\"flex-start\":verticalAlign===\"bottom\"?\"flex-end\":\"center\";return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",display:isFixedWidth?\"flex\":\"inline-block\",alignItems:isFixedHeight?alignItems:\"flex-start\",justifyContent:isFixedWidth?justifyContent:\"flex-start\",cursor:\"pointer\",overflow:\"hidden\",padding:padding,margin:0,...!isFixedWidth&&{minWidth:\"max-content\"}},onMouseEnter:()=>startTransition(()=>setIsHovered(true)),onMouseLeave:()=>startTransition(()=>setIsHovered(false)),children:/*#__PURE__*/_jsx(\"span\",{style:{display:\"flex\",position:\"relative\",textTransform:textTransform,...font},children:letters.map((letter,index)=>/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",display:\"inline-block\",overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(motion.div,{style:{display:\"inline-block\",position:\"relative\"},animate:{y:isHovered?direction===\"up\"?\"-100%\":\"100%\":\"0%\"},transition:{duration:animationDuration,delay:index*staggerDelay,ease:[.22,1,.36,1]},children:/*#__PURE__*/_jsx(\"span\",{style:{color:textColor,whiteSpace:\"pre\"},children:letter})}),/*#__PURE__*/_jsx(motion.div,{style:{display:\"inline-block\",position:\"absolute\",top:0,left:0},initial:{y:direction===\"up\"?\"100%\":\"-100%\"},animate:{y:isHovered?\"0%\":direction===\"up\"?\"100%\":\"-100%\"},transition:{duration:animationDuration,delay:index*staggerDelay,ease:[.22,1,.36,1]},children:/*#__PURE__*/_jsx(\"span\",{style:{color:hoverColor,whiteSpace:\"pre\"},children:letter})})]},index))})});}addPropertyControls(RollingText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"HOVER ME\"},textAlign:{type:ControlType.Enum,title:\"Text Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true},verticalAlign:{type:ControlType.Enum,title:\"Vertical Align\",options:[\"top\",\"center\",\"bottom\"],optionTitles:[\"Top\",\"Center\",\"Bottom\"],defaultValue:\"center\",displaySegmentedControl:true},textTransform:{type:ControlType.Enum,title:\"Transform\",options:[\"none\",\"uppercase\",\"lowercase\",\"capitalize\"],optionTitles:[\"None\",\"Uppercase\",\"Lowercase\",\"Capitalize\"],defaultValue:\"none\"},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"0px\"},direction:{type:ControlType.Enum,title:\"Direction\",options:[\"up\",\"down\"],optionTitles:[\"Up\",\"Down\"],defaultValue:\"up\",displaySegmentedControl:true},staggerDelay:{type:ControlType.Number,title:\"Stagger Delay\",defaultValue:.03,min:0,max:.2,step:.01,unit:\"s\"},animationDuration:{type:ControlType.Number,title:\"Duration\",defaultValue:.4,min:.1,max:2,step:.1,unit:\"s\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},hoverColor:{type:ControlType.Color,title:\"Hover Color\",defaultValue:\"#0099FF\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RollingText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RollingText.map"],"mappings":"yOAIG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK,WAAW,YAAU,KAAK,eAAa,IAAI,oBAAkB,GAAG,YAAU,UAAU,aAAW,UAAU,OAAK,YAAU,OAAO,gBAAc,SAAS,UAAQ,MAAM,gBAAc,OAAO,SAAO,EAAW,CAAC,EAAU,GAAcA,EAAS,EAAK,EAAQ,EAAQ,EAAK,MAAM,EAAE,EAAQ,EAAa,GAAO,QAAQ,OAAa,EAAc,GAAO,SAAS,OAAa,EAAe,IAAY,OAAO,aAAa,IAAY,QAAQ,WAAW,SAAe,EAAW,IAAgB,MAAM,aAAa,IAAgB,SAAS,WAAW,SAAS,OAAoB,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,SAAS,WAAW,QAAQ,EAAa,OAAO,eAAe,WAAW,EAAc,EAAW,aAAa,eAAe,EAAa,EAAe,aAAa,OAAO,UAAU,SAAS,SAAiB,UAAQ,OAAO,EAAE,GAAG,CAAC,GAAc,CAAC,SAAS,aAAa,CAAC,EAAE,iBAAiBC,MAAoB,EAAa,EAAI,CAAC,EAAE,iBAAiBA,MAAoB,EAAa,EAAK,CAAC,EAAE,SAAsB,EAAK,OAAO,CAAC,MAAM,CAAC,QAAQ,OAAO,SAAS,WAAyB,gBAAc,GAAG,CAAI,EAAE,SAAS,EAAQ,KAAK,EAAO,IAAqB,EAAM,MAAM,CAAC,MAAM,CAAC,SAAS,WAAW,QAAQ,eAAe,SAAS,QAAQ,EAAE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