{"version":3,"file":"GridPattern.Brrt_LLO.mjs","names":["useRef","useState","squareKey","newSquare","fadeTimeout"],"sources":["https:/framerusercontent.com/modules/ZPaD7xt6K4D8ifXSSHNb/yn9SQpha36QR8nv35zwx/GridPattern.js"],"sourcesContent":["// Square grid pattern with hover movement effect\n// Component size: 2000x1200px\n// Controls: square size, grid line color, movement intensity\n// On hover: pattern moves in the direction of mouse movement\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerIntrinsicWidth 2000\n * @framerIntrinsicHeight 1200\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function GridPattern(props){const{gridColor=\"#CCCCCC\",lineWidth=1,movementIntensity=20,highlightColor=\"#0099FF\",easing=\"ease-out\",horizontalSpacing=50,verticalSpacing=50,highlightDuration=1e3}=props;const containerRef=useRef(null);const[offset,setOffset]=useState({x:0,y:0});const[hoveredSquares,setHoveredSquares]=useState([]);const timeoutsRef=useRef(new Map);useEffect(()=>{const container=containerRef.current;if(!container)return;const handleMouseMove=e=>{const rect=container.getBoundingClientRect();const centerX=rect.left+rect.width/2;const centerY=rect.top+rect.height/2;const mouseX=e.clientX;const mouseY=e.clientY;const deltaX=(mouseX-centerX)/rect.width;const deltaY=(mouseY-centerY)/rect.height;const offsetX=deltaX*movementIntensity;const offsetY=deltaY*movementIntensity;// Calculate which square is being hovered\nconst relativeX=mouseX-rect.left;const relativeY=mouseY-rect.top;const col=Math.floor(relativeX/horizontalSpacing);const row=Math.floor(relativeY/verticalSpacing);startTransition(()=>{setOffset({x:offsetX,y:offsetY});setHoveredSquares(prev=>{// Remove all squares that are not this one and are not fading\nconst filteredPrev=prev.filter(sq=>sq.col!==col||sq.row!==row||sq.isFading);// Check if this square is already in the array (not fading)\nconst existsIndex=filteredPrev.findIndex(sq=>sq.col===col&&sq.row===row&&!sq.isFading);if(existsIndex!==-1){// If exists, restart fade timeout for this square\nconst existingSquare=filteredPrev[existsIndex];const oldKey=`${existingSquare.col}-${existingSquare.row}-${existingSquare.timestamp}`;// clear timeouts for previous\nif(timeoutsRef.current.has(oldKey)){clearTimeout(timeoutsRef.current.get(oldKey));timeoutsRef.current.delete(oldKey);}const updatedTimestamp=Date.now();const squareKey=`${col}-${row}-${updatedTimestamp}`;const newSquare={...existingSquare,timestamp:updatedTimestamp,isFading:false};const updated=[...filteredPrev];updated[existsIndex]=newSquare;// Set timeout to start fading\nconst fadeTimeout=setTimeout(()=>{startTransition(()=>{setHoveredSquares(current=>current.map(sq=>sq.col===col&&sq.row===row&&sq.timestamp===updatedTimestamp?{...sq,isFading:true}:sq));});const removeTimeout=setTimeout(()=>{startTransition(()=>{setHoveredSquares(current=>current.filter(sq=>!(sq.col===col&&sq.row===row&&sq.timestamp===updatedTimestamp)));});timeoutsRef.current.delete(squareKey);},300);timeoutsRef.current.set(squareKey,removeTimeout);},highlightDuration);timeoutsRef.current.set(squareKey,fadeTimeout);return updated;}const newSquare={col,row,timestamp:Date.now(),isFading:false};const squareKey=`${col}-${row}-${newSquare.timestamp}`;// Set timeout to start fading\nconst fadeTimeout=setTimeout(()=>{startTransition(()=>{setHoveredSquares(current=>current.map(sq=>sq.col===col&&sq.row===row&&sq.timestamp===newSquare.timestamp?{...sq,isFading:true}:sq));});// Set timeout to remove the square after fade animation\nconst removeTimeout=setTimeout(()=>{startTransition(()=>{setHoveredSquares(current=>current.filter(sq=>!(sq.col===col&&sq.row===row&&sq.timestamp===newSquare.timestamp)));});timeoutsRef.current.delete(squareKey);},300);timeoutsRef.current.set(squareKey,removeTimeout);},highlightDuration);timeoutsRef.current.set(squareKey,fadeTimeout);return[...filteredPrev,newSquare];});});};const handleMouseLeave=()=>{startTransition(()=>{setOffset({x:0,y:0});});};container.addEventListener(\"mousemove\",handleMouseMove);container.addEventListener(\"mouseleave\",handleMouseLeave);return()=>{container.removeEventListener(\"mousemove\",handleMouseMove);container.removeEventListener(\"mouseleave\",handleMouseLeave);// Clear all timeouts\ntimeoutsRef.current.forEach(timeout=>clearTimeout(timeout));timeoutsRef.current.clear();};},[movementIntensity,horizontalSpacing,verticalSpacing,highlightDuration]);const width=props.style?.width===\"100%\"?2e3:Number(props.style?.width)||2e3;const height=props.style?.height===\"100%\"?1200:Number(props.style?.height)||1200;const cols=Math.ceil(width/horizontalSpacing)+2;const rows=Math.ceil(height/verticalSpacing)+2;return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\"},children:/*#__PURE__*/_jsxs(\"svg\",{width:width,height:height,style:{position:\"absolute\",top:0,left:0,transform:`translate(${offset.x}px, ${offset.y}px)`,transition:`transform 0.3s ${easing}`},children:[/*#__PURE__*/_jsx(\"defs\",{children:/*#__PURE__*/_jsx(\"pattern\",{id:\"grid\",width:horizontalSpacing,height:verticalSpacing,patternUnits:\"userSpaceOnUse\",children:/*#__PURE__*/_jsx(\"rect\",{width:horizontalSpacing,height:verticalSpacing,fill:\"none\",stroke:gridColor,strokeWidth:lineWidth})})}),/*#__PURE__*/_jsx(\"rect\",{width:width+horizontalSpacing*2,height:height+verticalSpacing*2,x:-horizontalSpacing,y:-verticalSpacing,fill:\"url(#grid)\"}),hoveredSquares.map((square,index)=>/*#__PURE__*/_jsx(\"rect\",{x:square.col*horizontalSpacing,y:square.row*verticalSpacing,width:horizontalSpacing,height:verticalSpacing,fill:highlightColor,fillOpacity:square.isFading?0:.3,stroke:highlightColor,strokeWidth:lineWidth,strokeOpacity:square.isFading?0:1,style:{transition:square.isFading?\"fill-opacity 0.3s ease-out, stroke-opacity 0.3s ease-out\":\"fill-opacity 0.3s ease-in, stroke-opacity 0.3s ease-in\"}},`${square.col}-${square.row}-${square.timestamp}`))]})});}addPropertyControls(GridPattern,{horizontalSpacing:{type:ControlType.Number,title:\"Horizontal Spacing\",defaultValue:50,min:10,max:200,step:5,unit:\"px\"},verticalSpacing:{type:ControlType.Number,title:\"Vertical Spacing\",defaultValue:50,min:10,max:200,step:5,unit:\"px\"},gridColor:{type:ControlType.Color,title:\"Grid Color\",defaultValue:\"#CCCCCC\"},lineWidth:{type:ControlType.Number,title:\"Line Width\",defaultValue:1,min:.5,max:10,step:.5,unit:\"px\"},movementIntensity:{type:ControlType.Number,title:\"Movement Intensity\",defaultValue:20,min:0,max:100,step:5,unit:\"px\"},highlightColor:{type:ControlType.Color,title:\"Highlight Color\",defaultValue:\"#0099FF\"},highlightDuration:{type:ControlType.Number,title:\"Highlight Duration\",defaultValue:1e3,min:100,max:5e3,step:100,unit:\"ms\"},easing:{type:ControlType.Enum,title:\"Easing\",defaultValue:\"ease-out\",options:[\"linear\",\"ease\",\"ease-in\",\"ease-out\",\"ease-in-out\",\"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"],optionTitles:[\"Linear\",\"Ease\",\"Ease In\",\"Ease Out\",\"Ease In-Out\",\"Bounce\"]}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GridPattern\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicHeight\":\"1200\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"2000\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GridPattern.map"],"mappings":"sMAUG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,YAAU,UAAU,YAAU,EAAE,oBAAkB,GAAG,iBAAe,UAAU,SAAO,WAAW,oBAAkB,GAAG,kBAAgB,GAAG,oBAAkB,KAAK,EAAY,EAAaA,EAAO,KAAK,CAAM,CAAC,EAAO,GAAWC,EAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAM,CAAC,EAAe,GAAmBA,EAAS,EAAE,CAAC,CAAO,EAAYD,EAAO,IAAI,IAAI,CAAC,MAAc,CAAC,IAAM,EAAU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