{"version":3,"file":"LinesOverlayCode.CqB9WXlt.mjs","names":["useRef","useState","direction"],"sources":["https:/framerusercontent.com/modules/oFOs9dvv9P1TsgFFrdAS/gXFu0UHSN5pX1wQcam1p/LinesOverlayCode.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useRef,useState}from\"react\";/**\n * Animated horizontal lines overlay\n *\n * @framerDisableUnlink\n *\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 50\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function LineOverlay(props){const{lineColor,lineHeight,lineGap,speed=1,style={},preview=true,direction=\"horizontal\"}=props;const containerRef=useRef(null);const[dimensions,setDimensions]=useState({width:400,height:300});const isPreviewOrExport=RenderTarget.current()===RenderTarget.preview||RenderTarget.current()===RenderTarget.export;const shouldAnimate=isPreviewOrExport?true:preview;const actualLineHeight=Math.max(1,Math.round(dimensions.height*(lineHeight/100)));const actualLineGap=Math.max(0,Math.round(dimensions.height*(lineGap/100)));useEffect(()=>{if(!containerRef.current)return;const node=containerRef.current;function update(){setDimensions({width:node.offsetWidth,height:node.offsetHeight});}update();const ro=new window.ResizeObserver(update);ro.observe(node);return()=>ro.disconnect();},[]);const[lineAnims,setLineAnims]=useState([]);useEffect(()=>{const{height,width}=dimensions;const step=actualLineHeight+actualLineGap;if(step<=0)return;// Calculate count based on direction\nconst size=direction===\"horizontal\"?height:width;let count=Math.ceil((size-actualLineHeight)/step)+1;if(count>0&&(count-1)*step+actualLineHeight<size)count+=1;const arr=Array.from({length:count},(_,i)=>{const y=i*step;const direction=Math.random()>.5?1:-1;const minLen=width*.2;const maxLen=width*.9;const baseLen=minLen+Math.random()*(maxLen-minLen);const minOffset=0;const maxOffset=width-baseLen;const baseOffset=minOffset+Math.random()*(maxOffset-minOffset);const duration=.8+Math.random()*(2.5-.8);const targetOffset=minOffset+Math.random()*(maxOffset-minOffset);const targetLen=minLen+Math.random()*(maxLen-minLen);return{y,direction,baseLen,baseOffset,targetOffset,targetLen,duration};});setLineAnims(arr);},[dimensions,actualLineHeight,actualLineGap]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"svg\",{width:dimensions.width,height:dimensions.height,viewBox:`0 0 ${dimensions.width} ${dimensions.height}`,style:{position:\"absolute\",top:0,left:0,pointerEvents:\"none\",width:dimensions.width,height:dimensions.height},children:lineAnims.map((anim,i)=>/*#__PURE__*/_jsx(AnimatedLine,{position:anim.y+actualLineHeight/2,length:direction===\"horizontal\"?dimensions.width:dimensions.height,color:lineColor,lineWidth:actualLineHeight,speed:speed,animateLine:shouldAnimate,direction:direction},i))})});}function AnimatedLine({position,length,color,lineWidth,speed,animateLine,direction}){const[dash,setDash]=useState({dash:100,gap:100,offset:0,duration:1.5,direction:1});useEffect(()=>{const dashLen=length*(.2+Math.random()*.6);const gapLen=length*(.1+Math.random()*.5);const baseDuration=.8+Math.random()*1.7;const duration=baseDuration/(speed||1);const direction=Math.random()>.5?1:-1;setDash({dash:dashLen,gap:gapLen,offset:0,duration,direction});},[length,speed]);const[offset,setOffset]=useState(0);useEffect(()=>{if(!animateLine){setOffset(0);return;}let raf;let start=performance.now();function animate(now){const elapsed=(now-start)/1e3%dash.duration;const progress=elapsed/dash.duration;const total=dash.dash+dash.gap;const val=dash.direction*total*progress;setOffset(val);raf=requestAnimationFrame(animate);}raf=requestAnimationFrame(animate);return()=>cancelAnimationFrame(raf);},[dash,animateLine]);return /*#__PURE__*/_jsx(\"line\",{x1:direction===\"horizontal\"?0:position,y1:direction===\"horizontal\"?position:0,x2:direction===\"horizontal\"?length:position,y2:direction===\"horizontal\"?position:length,stroke:color,strokeWidth:lineWidth,strokeDasharray:`${dash.dash},${dash.gap}`,strokeDashoffset:offset,strokeLinecap:\"butt\",vectorEffect:\"non-scaling-stroke\"});}addPropertyControls(LineOverlay,{direction:{type:ControlType.Enum,title:\"Direction\",defaultValue:\"horizontal\",options:[\"horizontal\",\"vertical\"],optionTitles:[\"Horizontal\",\"Vertical\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\",icon:\"swap\"},lineColor:{type:ControlType.Color,title:\"Line Color\",defaultValue:\"#000000\"},lineHeight:{type:ControlType.Number,title:\"Line Height\",defaultValue:.5,min:.1,max:100,step:.1,unit:\"%\"},lineGap:{type:ControlType.Number,title:\"Line Gap\",defaultValue:0,min:0,max:100,step:.1,unit:\"%\"},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:1,min:.1,max:5,step:.05,unit:\"x\"},preview:{type:ControlType.Boolean,title:\"Preview\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\",description:\"Show line animation in Framer canvas.\"}});LineOverlay.displayName=\"Line Animator\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LineOverlay\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"50\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerDisableUnlink\":\"*\",\"framerIntrinsicWidth\":\"200\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LinesOverlayCode.map"],"mappings":"8MAUG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,YAAU,aAAW,UAAQ,QAAM,EAAE,QAAM,EAAE,CAAC,UAAQ,GAAK,YAAU,cAAc,EAAY,EAAaA,EAAO,KAAK,CAAM,CAAC,EAAW,GAAeC,EAAS,CAAC,MAAM,IAAI,OAAO,IAAI,CAAC,CAA2H,EAAlG,EAAa,SAAS,GAAG,EAAa,SAAS,EAAa,SAAS,GAAG,EAAa,OAA6C,GAAK,EAAc,EAAiB,KAAK,IAAI,EAAE,KAAK,MAAM,EAAW,QAAQ,E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