{"version":3,"file":"RollingText.DQ7Du5Gc.mjs","names":["useState","startTransition"],"sources":["https:/framerusercontent.com/modules/c5eCHaqT1Rs0lpu8BQgA/EgWhljozaW3POWuKnn7j/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\",height:\"1em\"},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\":{\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__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,GAAM,CAAO,EAAQ,EAAK,MAAM,GAAG,CAAO,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,cAAc,CAAC,CAAC,iBAAiBC,MAAoB,EAAa,GAAK,CAAC,CAAC,iBAAiBA,MAAoB,EAAa,GAAM,CAAC,CAAC,SAAsB,EAAK,OAAO,CAAC,MAAM,CAAC,QAAQ,OAAO,SAAS,WAAyB,gBAAc,GAAG,EAAK,CAAC,SAAS,EAAQ,KAAK,EAAO,IAAqB,EAAM,MAAM,CAAC,MAAM,CAAC,SAAS,WAAW,QAAQ,eAAe,SAAS,SA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