{"version":3,"file":"RollingText_1.DH1fufHo.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/pQ1hqFFSGLTlHgNroz1U/SlowK3irPOApBodFVCrj/RollingText_1.js"],"sourcesContent":["// Rolling Text Animation with Advanced Animation Patterns\n// Adds new animation options: bounce, wave, elastic, spring, easeIn, easeOut, easeInOut, and more\n// New features: Animation direction, Custom character sets, Performance & Accessibility\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";/**\n * Vertical Text Rolling Animation (Advanced)\n *\n * Each character position shows a vertical column of characters rolling to reveal the final character. Now with animation direction control, custom character sets, and accessibility features.\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 120\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function RollingText(props){const{text=\"MOTION\",duplicateCount=8,rollDuration=2,staggerDelay=.1,autoPlay=true,backgroundColor=\"#000000\",textColor=\"#FFFFFF\",font,animationPattern=\"sequential\",animationTrigger=\"inView\",animationDirection=\"auto\",useCustomCharacterSet=false,customCharacterSet=\"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\",respectReducedMotion=true}=props;const[isAnimating,setIsAnimating]=useState(false);const[prefersReducedMotion,setPrefersReducedMotion]=useState(false);const containerRef=useRef(null);const isInView=useInView(containerRef,{once:true});const isStatic=useIsStaticRenderer();// Check for reduced motion preference\nuseEffect(()=>{if(typeof window!==\"undefined\"&&respectReducedMotion){const mediaQuery=window.matchMedia(\"(prefers-reduced-motion: reduce)\");setPrefersReducedMotion(mediaQuery.matches);const handleChange=e=>{setPrefersReducedMotion(e.matches);};mediaQuery.addEventListener(\"change\",handleChange);return()=>mediaQuery.removeEventListener(\"change\",handleChange);}},[respectReducedMotion]);useEffect(()=>{let shouldAnimate=false;if(autoPlay&&!isStatic&&!prefersReducedMotion){if(animationTrigger===\"inView\"&&isInView)shouldAnimate=true;if(animationTrigger===\"onAppear\")shouldAnimate=true;}if(shouldAnimate){const timer=setTimeout(()=>{startTransition(()=>setIsAnimating(true));},100);return()=>clearTimeout(timer);}},[autoPlay,isInView,isStatic,animationTrigger,prefersReducedMotion]);const handleReplay=()=>{if(prefersReducedMotion&&respectReducedMotion)return;startTransition(()=>{setIsAnimating(false);setTimeout(()=>{startTransition(()=>setIsAnimating(true));},50);});};const characters=text.split(\"\");// For random, generate a stable random delay per character\nconst randomDelays=characters.map((_,i)=>Math.random()*staggerDelay*characters.length);// For wave, bounce, elastic, spring, easeIn, easeOut, easeInOut, set up pattern-specific delays and easings\nfunction getDelay(index){switch(animationPattern){case\"sequential\":return index*staggerDelay;case\"alternating\":return index*staggerDelay;case\"random\":return randomDelays[index];case\"together\":return 0;case\"wave\":return Math.sin(index)*staggerDelay*2+index*staggerDelay*.5;case\"bounce\":return index*staggerDelay*.7;case\"elastic\":return index*staggerDelay*.5;case\"spring\":return index*staggerDelay*.5;case\"easeIn\":return index*staggerDelay*.8;case\"easeOut\":return index*staggerDelay*.8;case\"easeInOut\":return index*staggerDelay*.8;default:return index*staggerDelay;}}function getEase(){switch(animationPattern){case\"bounce\":return[.68,-.55,.27,1.55];case\"wave\":return[.4,0,.2,1];case\"elastic\":return[.87,0,.13,1];case\"spring\":return\"spring\";case\"easeIn\":return[.42,0,1,1];case\"easeOut\":return[0,0,.58,1];case\"easeInOut\":return[.42,0,.58,1];default:return[.25,.46,.45,.94];}}// Generate character set for rolling effect\nfunction generateCharacterSet(targetChar){if(!useCustomCharacterSet){// Default behavior: use the same character repeated\nreturn Array(duplicateCount).fill(targetChar);}const chars=customCharacterSet.split(\"\");const result=[];// Start with target character, fill with random characters, end with target character\nresult.push(targetChar)// Always start with the target character\n;for(let i=0;i<duplicateCount-2;i++){const randomChar=chars[Math.floor(Math.random()*chars.length)];result.push(randomChar);}result.push(targetChar)// Always end with the target character\n;return result;}// If reduced motion is preferred, show static text\nif(prefersReducedMotion&&respectReducedMotion){return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...props.style,position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"span\",{style:{color:textColor,...font},children:text})});}return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...props.style,position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",overflow:\"hidden\",userSelect:\"none\"},children:/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:\"0.05em\",...font},children:characters.map((char,index)=>/*#__PURE__*/_jsx(CharacterColumn,{character:char,characterSet:generateCharacterSet(char),rollDuration:rollDuration,delay:getDelay(index),isAnimating:isAnimating,textColor:textColor,font:font,isStatic:isStatic,animationPattern:animationPattern,characterIndex:index,ease:getEase(),animationDirection:animationDirection},`${char}-${index}`))})});}function CharacterColumn({character,characterSet,rollDuration,delay,isAnimating,textColor,font,isStatic,animationPattern,characterIndex,ease,animationDirection}){// Calculate the height needed to show one character\nconst lineHeight=parseFloat(font?.lineHeight||\"1em\");const fontSize=parseFloat(font?.fontSize||\"60px\");const characterHeight=fontSize*lineHeight;// Calculate total scroll distance (all characters minus the final visible one)\nconst totalScrollDistance=characterHeight*(characterSet.length-1);// Determine animation direction\nlet shouldRollFromBottom=false;if(animationDirection===\"down\"){shouldRollFromBottom=true;}else if(animationDirection===\"up\"){shouldRollFromBottom=false;}else{// Use existing logic for alternating pattern\nconst isOddPosition=characterIndex%2===0;shouldRollFromBottom=animationPattern===\"alternating\"&&!isOddPosition;}// Set initial and final positions based on direction\nconst initialY=shouldRollFromBottom?-totalScrollDistance:0;const finalY=shouldRollFromBottom?0:-totalScrollDistance;if(isStatic){return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",height:`${characterHeight}px`,overflow:\"hidden\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(\"span\",{style:{color:textColor,...font,lineHeight:font?.lineHeight||\"1em\"},children:character})});}return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",height:`${characterHeight}px`,overflow:\"hidden\",display:\"flex\",alignItems:\"flex-start\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(motion.div,{style:{display:\"flex\",flexDirection:\"column\",alignItems:\"center\"},initial:{y:initialY},animate:isAnimating?{y:finalY}:{y:initialY},transition:{duration:rollDuration,delay:delay,ease:ease,type:typeof ease===\"string\"?ease:\"tween\"},children:characterSet.map((char,index)=>/*#__PURE__*/_jsx(\"span\",{style:{color:textColor,height:`${characterHeight}px`,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",...font,lineHeight:font?.lineHeight||\"1em\"},children:char},index))})});}addPropertyControls(RollingText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"MOTION\"},animationPattern:{type:ControlType.Enum,title:\"Animation Pattern\",options:[\"sequential\",\"alternating\",\"random\",\"together\",\"bounce\",\"wave\",\"elastic\",\"spring\",\"easeIn\",\"easeOut\",\"easeInOut\"],optionTitles:[\"Sequential\",\"Alternating\",\"Random\",\"Together\",\"Bounce\",\"Wave\",\"Elastic\",\"Spring\",\"Ease In\",\"Ease Out\",\"Ease InOut\"],defaultValue:\"sequential\",displaySegmentedControl:false},animationTrigger:{type:ControlType.Enum,title:\"Trigger\",options:[\"inView\",\"onAppear\"],optionTitles:[\"In View\",\"On Appear\"],defaultValue:\"inView\",displaySegmentedControl:false},animationDirection:{type:ControlType.Enum,title:\"Direction\",options:[\"up\",\"down\",\"auto\"],optionTitles:[\"Up\",\"Down\",\"Auto\"],defaultValue:\"auto\",displaySegmentedControl:false},useCustomCharacterSet:{type:ControlType.Boolean,title:\"Custom Characters\",defaultValue:false,enabledTitle:\"Custom\",disabledTitle:\"Same Letter\",displaySegmentedControl:false},customCharacterSet:{type:ControlType.String,title:\"Character Set\",defaultValue:\"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\",placeholder:\"Enter characters to roll through...\",hidden:({useCustomCharacterSet})=>!useCustomCharacterSet},respectReducedMotion:{type:ControlType.Boolean,title:\"Respect Reduced Motion\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\",displaySegmentedControl:false},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"60px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},duplicateCount:{type:ControlType.Number,title:\"Roll Count\",defaultValue:8,min:3,max:20,step:1,hidden:({useCustomCharacterSet})=>useCustomCharacterSet},rollDuration:{type:ControlType.Number,title:\"Roll Duration\",defaultValue:2,min:.5,max:5,step:.1,unit:\"s\"},staggerDelay:{type:ControlType.Number,title:\"Stagger Delay\",defaultValue:.1,min:0,max:.5,step:.01,unit:\"s\"},autoPlay:{type:ControlType.Boolean,title:\"Auto Play\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",displaySegmentedControl:false},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RollingText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"400\",\"framerIntrinsicHeight\":\"120\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RollingText_1.map"],"mappings":"wQAaG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK,SAAS,iBAAe,EAAE,eAAa,EAAE,eAAa,GAAG,WAAS,GAAK,kBAAgB,UAAU,YAAU,UAAU,OAAK,mBAAiB,aAA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