{"version":3,"file":"InfiniteScrollText.B7AzVkXT.mjs","names":["useRef","useState","p"],"sources":["https:/framerusercontent.com/modules/xoyAmULk7gSQGorRseC6/yEIHplGRy9ALQcVt1YaF/InfiniteScrollText.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useEffect,useState}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer,RenderTarget}from\"framer\";export default function InfiniteScroll(props){const{texts,background,font,gradientColors,style,textColor,fillType,group={speed:80,direction:\"left\",rotate:0,spacing:32},bannerHeight=56}=props;const{speed,direction,rotate,spacing}=group;const isStatic=useIsStaticRenderer();const containerRef=useRef(null);const[textWidth,setTextWidth]=useState(0);const[viewWidth,setViewWidth]=useState(300);const[offset,setOffset]=useState(0);// Mede container e bloco de texto\nuseEffect(()=>{if(!containerRef.current)return;const w=containerRef.current.offsetWidth||300;setViewWidth(w);const blockEl=containerRef.current.querySelector(\".scroll-block\");if(blockEl)setTextWidth(blockEl.offsetWidth);},[texts,font,spacing,rotate,bannerHeight]);// Movimento\nuseEffect(()=>{if(isStatic||RenderTarget.current()===RenderTarget.thumbnail||textWidth<=0)return;let frame;let last=performance.now();function animate(now){const elapsed=now-last;last=now;const delta=speed/1e3*elapsed*(direction===\"left\"?-1:1);setOffset(prev=>{let next=prev+delta;const blockWidth=textWidth;while(next>0)next-=blockWidth;while(next<-blockWidth)next+=blockWidth;return next;});frame=requestAnimationFrame(animate);}frame=requestAnimationFrame(animate);return()=>cancelAnimationFrame(frame);},[speed,direction,textWidth,isStatic]);const numDuplicates=textWidth>0?Math.ceil(viewWidth/textWidth)+2:3;const outerStyle={...style,width:\"100%\",height:\"100%\",overflow:\"visible\",position:\"relative\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"};// 🔹 faixa que é rotacionada e centrada no meio\nconst stripeStyle={position:\"absolute\",top:\"50%\",left:\"50%\",width:\"200%\",height:`${bannerHeight}px`,background,transform:`translate(-50%, -50%) rotate(${rotate}deg)`,transformOrigin:\"center center\",display:\"flex\",alignItems:\"center\",overflow:\"hidden\"};const scrollStyle={display:\"flex\",flexDirection:\"row\",whiteSpace:\"nowrap\",willChange:\"transform\",transform:`translateX(${offset}px)`};const repeatedText=Array.from({length:numDuplicates}).map((_,i)=>/*#__PURE__*/_jsx(\"ul\",{className:i===0?\"scroll-block\":undefined,style:{display:\"flex\",margin:0,padding:0,listStyle:\"none\"},children:texts.map((t,idx)=>/*#__PURE__*/_jsx(\"li\",{style:{...getTextStyle({font,gradientColors,textColor,fillType}),whiteSpace:\"nowrap\",display:\"inline-block\",marginRight:spacing},children:t},idx))},i));if(isStatic||RenderTarget.current()===RenderTarget.thumbnail){return /*#__PURE__*/_jsx(\"div\",{style:outerStyle,children:/*#__PURE__*/_jsx(\"div\",{style:stripeStyle,children:texts.length>0?texts.map((t,idx)=>/*#__PURE__*/_jsx(\"span\",{style:{...getTextStyle({font,gradientColors,textColor,fillType}),whiteSpace:\"nowrap\",marginLeft:idx===0?0:spacing},children:t},idx)):/*#__PURE__*/_jsx(\"span\",{style:{...font,opacity:.5,fontSize:14},children:\"Add text items.\"})})});}return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:outerStyle,children:/*#__PURE__*/_jsx(\"div\",{style:stripeStyle,children:/*#__PURE__*/_jsx(\"div\",{style:scrollStyle,children:repeatedText})})});}// Text gradient helper\nfunction getTextStyle({font,gradientColors,textColor,fillType}){if(fillType===\"color\")return{...font,color:textColor};if(!gradientColors||gradientColors.length===0)return{...font,color:textColor};if(gradientColors.length===1)return{...font,color:gradientColors[0]};const gradient=`linear-gradient(90deg, ${gradientColors.join(\", \")})`;return{...font,backgroundImage:gradient,backgroundRepeat:\"no-repeat\",backgroundSize:\"100% 100%\",backgroundClip:\"text\",WebkitBackgroundClip:\"text\",color:\"transparent\",WebkitTextFillColor:\"transparent\"};}// Framer property controls\naddPropertyControls(InfiniteScroll,{group:{type:ControlType.Object,title:\"Scroll Settings\",controls:{speed:{type:ControlType.Number,title:\"Speed\",defaultValue:80,min:10,max:500,unit:\"px/s\",step:1},direction:{type:ControlType.Enum,title:\"Direction\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true},rotate:{type:ControlType.Number,title:\"Rotate\",defaultValue:0,min:-180,max:180,unit:\"deg\"},spacing:{type:ControlType.Number,title:\"Spacing\",defaultValue:32,min:0,max:200,unit:\"px\"}}},texts:{type:ControlType.Array,title:\"Texts\",control:{type:ControlType.String,defaultValue:\"Infinite Scroll Text\"},defaultValue:[],maxCount:10},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#111111\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#00E6FF\",hidden:p=>p.fillType===\"gradient\"},gradientColors:{type:ControlType.Array,title:\"Text Colors\",control:{type:ControlType.Color,defaultValue:\"#7928CA\"},defaultValue:[],maxCount:5,hidden:p=>p.fillType===\"color\"},fillType:{type:ControlType.Enum,title:\"Fill\",options:[\"color\",\"gradient\"],optionTitles:[\"Color\",\"Gradient\"],defaultValue:\"color\",displaySegmentedControl:true},bannerHeight:{type:ControlType.Number,title:\"Banner Height\",defaultValue:56,min:16,max:200,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"InfiniteScroll\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./InfiniteScrollText.map"],"mappings":"uMAA6K,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,QAAM,aAAW,OAAK,iBAAe,QAAM,YAAU,WAAS,QAAM,CAAC,MAAM,GAAG,UAAU,OAAO,OAAO,EAAE,QAAQ,GAAG,CAAC,eAAa,IAAI,EAAW,CAAC,QAAM,YAAU,SAAO,WAAS,EAAY,EAAS,GAAqB,CAAO,EAAaA,EAAO,KAAK,CAAM,CAAC,EAAU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