{"version":3,"file":"Custom_Ticker.CPSGzAzA.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/hMZeF4DIa2o5hkhmmMEQ/xr0ZR7p8W5paqAL5NeKx/Custom_Ticker.js"],"sourcesContent":["// Ticker component with pause-on-out-of-view and children height fill\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef,useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useInView}from\"framer\";/**\n * Ticker with pause-on-out-of-view and children height fill\n *\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 60\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function Ticker(props){const{speed,hoverSpeed,direction,gap,padding,pauseOnOutOfView,clipping,invertOrder,showLastChildAtStart,playOnCanvas,children,style}=props;const containerRef=useRef(null);// For seamless right direction, start offset at -oneSetWidth\nconst[offset,setOffset]=useState(0);const[contentWidth,setContentWidth]=useState(0);const[containerWidth,setContainerWidth]=useState(0);const[isHovering,setIsHovering]=useState(false);const inView=useInView(containerRef,{amount:.1});// Padding style\nconst paddingStyle={padding};// Fade mask style\nconst fadeMask=clipping.type===\"fade\"?`linear-gradient(90deg, transparent 0%, black ${clipping.fadeWidth}%, black ${100-clipping.fadeWidth}%, transparent 100%)`:undefined;// Children as array\nlet childArray=Array.isArray(children)?children:[children];childArray=childArray.filter(Boolean);// Invert order if requested\nif(invertOrder){childArray=[...childArray].reverse();}// Calculate repeat count for seamless looping\nlet repeatCount=2;if(childArray.length>0&&containerWidth>0&&contentWidth>0){// Ensure we have enough content to create seamless loop\nrepeatCount=Math.max(3,Math.ceil(containerWidth*3/contentWidth));}// Create seamless array\nlet seamlessArray=[];for(let i=0;i<repeatCount;i++){seamlessArray=seamlessArray.concat(childArray);}const hasChildren=childArray.length>0;// Measure content and container widths\nuseEffect(()=>{if(!containerRef.current)return;const container=containerRef.current;const content=container.querySelector(\".ticker-content\");if(content&&childArray.length>0){// Measure just the original content width (one set of children)\nconst singleSetWidth=content.scrollWidth/repeatCount;setContentWidth(singleSetWidth);setContainerWidth(container.offsetWidth);}},[children,style?.width,style?.height,repeatCount,invertOrder]);// Animation loop\nuseEffect(()=>{if(!contentWidth||!containerWidth||!hasChildren)return;if(pauseOnOutOfView&&!inView)return;if(!playOnCanvas&&typeof window!==\"undefined\"&&window.location&&window.location.pathname.includes(\"canvas\"))return;// Calculate the width of one complete set including gaps\nconst gapWidth=gap*(childArray.length-1);const oneSetWidth=contentWidth+gapWidth;// For right direction, set initial offset to -oneSetWidth\nif(direction===\"right\"&&offset===0){setOffset(-oneSetWidth);}let frame;let last=performance.now();function animate(now){const elapsed=now-last;last=now;const pxPerMs=(isHovering?hoverSpeed:speed)/1e3;startTransition(()=>{setOffset(prev=>{let next=direction===\"left\"?prev-pxPerMs*elapsed:prev+pxPerMs*elapsed;// Reset seamlessly when one complete set has scrolled\nif(direction===\"left\"&&Math.abs(next)>=oneSetWidth){next=next+oneSetWidth;}if(direction===\"right\"&&next>=0){next=next-oneSetWidth;}if(direction===\"right\"&&next<-oneSetWidth){next=next+oneSetWidth;}return next;});});frame=requestAnimationFrame(animate);}frame=requestAnimationFrame(animate);return()=>cancelAnimationFrame(frame);},[contentWidth,containerWidth,speed,hoverSpeed,isHovering,direction,gap,pauseOnOutOfView,inView,playOnCanvas,childArray.length,hasChildren,invertOrder,offset]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,width:\"100%\",height:\"100%\",overflow:clipping.type===\"overflow\"?clipping.overflowVisible?\"visible\":\"hidden\":\"hidden\",position:\"relative\",display:\"flex\",alignItems:\"stretch\",...clipping.type===\"fade\"?{WebkitMaskImage:fadeMask,maskImage:fadeMask,WebkitMaskSize:\"100% 100%\",maskSize:\"100% 100%\",WebkitMaskRepeat:\"no-repeat\",maskRepeat:\"no-repeat\"}:{}},onMouseEnter:()=>setIsHovering(true),onMouseLeave:()=>setIsHovering(false),children:hasChildren?/*#__PURE__*/_jsx(\"div\",{className:\"ticker-content\",style:{display:\"flex\",flexDirection:\"row\",alignItems:\"stretch\",gap,position:\"absolute\",left:offset,top:0,height:\"100%\",willChange:\"transform\",...paddingStyle},children:seamlessArray.map((child,i)=>/*#__PURE__*/_jsx(\"div\",{style:{height:\"100%\",display:\"flex\",alignItems:\"stretch\"},children:child},i))}):/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",background:\"#edeafc\",border:\"2px solid #a385ff\",borderRadius:4,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",position:\"absolute\",left:0,top:0,boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{fontSize:48,marginBottom:12,display:\"block\",lineHeight:1},\"aria-hidden\":\"true\",children:\"✨\"}),/*#__PURE__*/_jsx(\"div\",{style:{color:\"#7c5cff\",fontWeight:700,fontSize:20,marginBottom:4,textAlign:\"center\"},children:\"Connect to Content\"}),/*#__PURE__*/_jsxs(\"div\",{style:{color:\"#a385ff\",fontWeight:500,fontSize:15,textAlign:\"center\",maxWidth:260,lineHeight:1.4},children:[\"Add layers or components to\",/*#__PURE__*/_jsx(\"br\",{}),\"infinitely loop on your page.\"]})]})});}addPropertyControls(Ticker,{children:{type:ControlType.Slot,title:\"Children\",maxCount:10},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:80,min:10,max:500,unit:\"%\",step:1},hoverSpeed:{type:ControlType.Number,title:\"Hover Speed\",defaultValue:20,min:0,max:500,unit:\"x\",step:1},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:10,min:0,max:200,step:1,unit:\"px\"},direction:{type:ControlType.Enum,title:\"Direction\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true},pauseOnOutOfView:{type:ControlType.Boolean,title:\"Pause Out of View\",defaultValue:true,enabledTitle:\"Pause\",disabledTitle:\"Always Run\"},clipping:{type:ControlType.Object,title:\"Clipping\",controls:{type:{type:ControlType.Enum,title:\"Type\",options:[\"fade\",\"overflow\"],optionTitles:[\"Fade\",\"Overflow\"],defaultValue:\"fade\",displaySegmentedControl:true},fadeWidth:{type:ControlType.Number,title:\"Fade Width\",defaultValue:25,min:0,max:50,step:1,unit:\"%\",hidden:({type})=>type!==\"fade\"},fadeInset:{type:ControlType.Number,title:\"Fade Inset\",defaultValue:0,min:0,max:50,step:1,unit:\"px\",hidden:({type})=>type!==\"fade\"},fadeOpacity:{type:ControlType.Number,title:\"Fade Opacity\",defaultValue:1,min:0,max:1,step:.01,hidden:({type})=>type!==\"fade\"},overflowVisible:{type:ControlType.Boolean,title:\"Overflow\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\",hidden:({type})=>type!==\"overflow\"}},defaultValue:{type:\"fade\",fadeWidth:25,fadeInset:0,fadeOpacity:1,overflowVisible:false}},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"10px\"},invertOrder:{type:ControlType.Boolean,title:\"Invert Order\",defaultValue:false,enabledTitle:\"Reversed\",disabledTitle:\"Normal\"},playOnCanvas:{type:ControlType.Boolean,title:\"Play on Canvas\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Ticker\",\"slots\":[\"children\"],\"annotations\":{\"framerIntrinsicHeight\":\"60\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"600\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Custom_Ticker.map"],"mappings":"yPASG,SAAwB,EAAO,EAAM,CAAC,GAAK,CAAC,QAAM,aAAW,YAAU,MAAI,UAAQ,mBAAiB,WAAS,cAAY,uBAAqB,eAAa,WAAS,SAAO,EAAY,EAAaA,EAAO,IAAI,EAC7M,CAAC,EAAO,GAAWC,EAAS,C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