{"version":3,"file":"BlurCycle_Prod.CFZkZjO2.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/K9XZikamzRg8diOTO0v6/Lg2YQXIGwz2nU25pKVBI/BlurCycle_Prod.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";const MAX_SPEED=20;const defaultTransition={stiffness:100,damping:20,mass:1};/**\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 200\n *\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function BlurCycle({text,speed,delay,font,userSelect,color,tag,loop,alignment}){const Tag=tag;const content=text.split(\", \").map(phrase=>phrase.replace(/\\s+/g,\" \").trim());const[iteration,setIteration]=useState(0);const[isFirstRender,setIsFirstRender]=useState(true);const speedFormatted=(MAX_SPEED-speed+1)/20*5;const delayFormattedMs=delay*1e3;const speedFormattedMs=speedFormatted*1e3;const MAX_BLUR=parseInt(font.fontSize)*.2||4.8;useEffect(()=>{const timeout=isFirstRender?delayFormattedMs+speedFormattedMs/4:speedFormattedMs+delayFormattedMs;const interval=setInterval(()=>{setIsFirstRender(false);if(iteration<content.length-1){setIteration(prev=>prev+1);}else if(loop){setIteration(0);}},timeout);return()=>clearInterval(interval);},[iteration,loop,isFirstRender]);return /*#__PURE__*/_jsxs(\"div\",{style:{userSelect:userSelect?\"auto\":\"none\",position:\"relative\",display:\"flex\",flexDirection:\"row\",overflow:\"visible\",width:\"calc(100% + 10px)\",justifyContent:alignment===\"center\"?\"center\":alignment===\"right\"?\"flex-end\":\"flex-start\"},children:[/*#__PURE__*/_jsx(Tag,{\"aria-hidden\":true,style:{fontSize:\"24px\",...font,marginBlockStart:\"0px\",marginBlockEnd:\"0px\",pointerEvents:\"none\",opacity:0,whiteSpace:\"pre-wrap\",width:\"100%\",textAlign:alignment},children:content.reduce((longest,current)=>current.length>longest.length?current:longest)}),RenderTarget.current()===RenderTarget.canvas&&/*#__PURE__*/_jsx(Tag,{style:{fontSize:\"24px\",...font,color,marginBlockStart:\"0px\",marginBlockEnd:\"0px\",whiteSpace:\"pre-wrap\",position:\"absolute\",top:0,left:0,width:\"100%\",textAlign:alignment},children:content[0]}),RenderTarget.current()!==RenderTarget.canvas&&/*#__PURE__*/_jsx(_Fragment,{children:content.map((phrase,phraseIndex)=>{// Calculate the absolute index for each character up front\nlet charIndex=0;const segments=phrase.split(/(\\s+|\\b)/).map(segment=>({text:segment,chars:segment.split(\"\").map(char=>({char,originalIndex:charIndex++}))}));return /*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,overflow:\"visible\",width:\"100%\",textAlign:alignment},children:/*#__PURE__*/_jsx(AnimatePresence,{mode:\"sync\",children:iteration===phraseIndex&&/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",flexWrap:\"wrap\",width:\"100%\",justifyContent:alignment===\"center\"?\"center\":alignment===\"right\"?\"flex-end\":\"flex-start\",gap:0},children:segments.map((segment,segmentIndex)=>/*#__PURE__*/_jsx(\"div\",{style:{display:\"inline-flex\",flexWrap:\"nowrap\",whiteSpace:\"pre\"},children:segment.chars.map(({char,originalIndex})=>{const itemTransition={hidden:{opacity:0,filter:`blur(${MAX_BLUR}px)`,zIndex:1,transition:{...defaultTransition,duration:speedFormatted/2,delay:speedFormatted/2*.5}},show:{opacity:1,filter:\"blur(0px)\",zIndex:1,transition:{...defaultTransition,duration:speedFormatted/2,delay:speedFormatted/2*.5+originalIndex/(phrase.length-1)*(speedFormatted/3)}},exit:{opacity:0,filter:`blur(${MAX_BLUR/60}px)`,zIndex:0,transition:{...defaultTransition,duration:speedFormatted/2}}};return /*#__PURE__*/_jsx(motion.div,{variants:itemTransition,initial:isFirstRender?\"show\":\"hidden\",animate:\"show\",exit:\"exit\",style:{display:\"inline-block\"},children:/*#__PURE__*/_jsx(Tag,{style:{fontSize:\"24px\",...font,color,marginBlockStart:\"0px\",marginBlockEnd:\"0px\",opacity:1},children:char})},phrase+originalIndex);})},segmentIndex))})})},phraseIndex);})})]});}BlurCycle.displayName=\"Blur Cycle\";addPropertyControls(BlurCycle,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"to learn Framer, to build websites\",description:\"Divide phrases with a comma (,) if you want to display them separately.\"},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:MAX_SPEED/2,min:1,max:MAX_SPEED},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:1,min:0,max:10},font:{title:\"Font\",type:ControlType.Font,controls:\"extended\"},color:{title:\"Color\",type:ControlType.Color,defaultValue:\"#999\"},alignment:{type:ControlType.Enum,displaySegmentedControl:true,title:\"Alignment\",defaultValue:\"left\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"]},userSelect:{title:\"User Select\",type:ControlType.Boolean,defaultValue:false},tag:{type:ControlType.Enum,title:\"Tag\",defaultValue:\"p\",displaySegmentedControl:true,segmentedControlDirection:\"horizontal\",options:[\"h1\",\"h2\",\"h3\",\"p\"],optionTitles:[\"H1\",\"H2\",\"H3\",\"P\"]},loop:{title:\"Loop\",type:ControlType.Boolean,defaultValue:true,description:\"More components at [Framer University](https://frameruni.link/cc).\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BlurCycle\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"400\",\"framerSupportedLayoutWidth\":\"any\",\"framerDisableUnlink\":\"*\",\"framerIntrinsicHeight\":\"200\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BlurCycle_Prod.map"],"mappings":"+YAQG,SAAwB,EAAU,CAAC,OAAK,QAAM,QAAM,OAAK,aAAW,QAAM,MAAI,OAAK,aAAW,CAAC,IAAM,EA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