{"version":3,"file":"WavyGridBackground.DPeBZm46.mjs","names":["useRef","useCallback","_Fragment"],"sources":["https:/framerusercontent.com/modules/2aR6StHZzQFv7H3zgl65/Yl8D9DpiE15ha0h06oLZ/WavyGridBackground.js"],"sourcesContent":["// Responsive background with a wavy distorted grid pattern\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useCallback,useRef,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function WavyGridBackground(props){const{backgroundColor=\"#000000\",gridColor=\"#333333\",gridSize=30,gridOpacity=.8,waveAmplitude=20,waveFrequency=.02,animationSpeed=2,enableAnimation=false,gridThickness=1,enableSideMask=false,maskColor=\"#000000\",maskWidth=100,enableTopBottomMask=false,topBottomMaskColor=\"#000000\",topBottomMaskHeight=100}=props;const canvasRef=useRef(null);const resizeObserverRef=useRef(null);const drawGrid=useCallback(canvas=>{const ctx=canvas.getContext(\"2d\");if(!ctx)return;const parent=canvas.parentElement;if(!parent)return;// Get dimensions from parent container\nconst width=parent.clientWidth;const height=parent.clientHeight;if(width<=0||height<=0)return;const dpr=window.devicePixelRatio||1;// Set actual size in memory (scaled to account for extra pixel density)\ncanvas.width=width*dpr;canvas.height=height*dpr;// Scale the drawing context so everything draws at the correct size\nctx.scale(dpr,dpr);// Set display size (css pixels)\ncanvas.style.width=width+\"px\";canvas.style.height=height+\"px\";ctx.clearRect(0,0,width,height);ctx.strokeStyle=gridColor;ctx.lineWidth=gridThickness;ctx.globalAlpha=gridOpacity;// Draw wavy grid with responsive sizing\nconst effectiveGridSize=Math.max(gridSize*Math.min(width/800,height/600),10);for(let x=0;x<=width;x+=effectiveGridSize){ctx.beginPath();for(let y=0;y<=height;y+=2){const waveX=x+Math.sin(y*waveFrequency)*waveAmplitude;if(y===0){ctx.moveTo(waveX,y);}else{ctx.lineTo(waveX,y);}}ctx.stroke();}for(let y=0;y<=height;y+=effectiveGridSize){ctx.beginPath();for(let x=0;x<=width;x+=2){const waveY=y+Math.sin(x*waveFrequency)*waveAmplitude;if(x===0){ctx.moveTo(x,waveY);}else{ctx.lineTo(x,waveY);}}ctx.stroke();}},[gridSize,gridColor,gridThickness,gridOpacity,waveAmplitude,waveFrequency]);// Redraw when any visual property changes\nuseEffect(()=>{if(canvasRef.current){drawGrid(canvasRef.current);}},[gridColor,gridSize,gridOpacity,waveAmplitude,waveFrequency,gridThickness,drawGrid]);const setupCanvas=useCallback(canvas=>{if(!canvas)return;// Clean up previous observer\nif(resizeObserverRef.current){resizeObserverRef.current.disconnect();}// Delay initial draw to ensure parent has proper dimensions\nsetTimeout(()=>{drawGrid(canvas);},0);// Handle resize\nresizeObserverRef.current=new ResizeObserver(()=>{drawGrid(canvas);});const parent=canvas.parentElement;if(parent){resizeObserverRef.current.observe(parent);}},[drawGrid]);useEffect(()=>{return()=>{if(resizeObserverRef.current){resizeObserverRef.current.disconnect();}};},[]);if(typeof window===\"undefined\"){return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor,overflow:\"hidden\",minWidth:0,minHeight:0}});}return /*#__PURE__*/_jsxs(\"div\",{style:{...props.style,position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor,overflow:\"hidden\",minWidth:0,minHeight:0},children:[/*#__PURE__*/_jsx(\"canvas\",{ref:canvas=>{canvasRef.current=canvas;setupCanvas(canvas);},style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",pointerEvents:\"none\"}}),enableSideMask&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:`${maskWidth}px`,height:\"100%\",background:`linear-gradient(to right, ${maskColor}, transparent)`,pointerEvents:\"none\",zIndex:1}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,right:0,width:`${maskWidth}px`,height:\"100%\",background:`linear-gradient(to left, ${maskColor}, transparent)`,pointerEvents:\"none\",zIndex:1}})]}),enableTopBottomMask&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:`${topBottomMaskHeight}px`,background:`linear-gradient(to bottom, ${topBottomMaskColor}, transparent)`,pointerEvents:\"none\",zIndex:1}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",bottom:0,left:0,width:\"100%\",height:`${topBottomMaskHeight}px`,background:`linear-gradient(to top, ${topBottomMaskColor}, transparent)`,pointerEvents:\"none\",zIndex:1}})]})]});}addPropertyControls(WavyGridBackground,{backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#000000\",description:\"Created by [Caio Calderari](https://www.calderari.com.br)\"},gridColor:{type:ControlType.Color,title:\"Grid Color\",defaultValue:\"#333333\"},gridSize:{type:ControlType.Number,title:\"Grid Size\",defaultValue:30,min:10,max:100,step:5,unit:\"px\"},gridThickness:{type:ControlType.Number,title:\"Grid Thickness\",defaultValue:1,min:.5,max:5,step:.5,unit:\"px\"},gridOpacity:{type:ControlType.Number,title:\"Grid Opacity\",defaultValue:.8,min:0,max:1,step:.1},waveAmplitude:{type:ControlType.Number,title:\"Wave Amplitude\",defaultValue:20,min:0,max:50,step:2,unit:\"px\"},waveFrequency:{type:ControlType.Number,title:\"Wave Frequency\",defaultValue:.02,min:.005,max:.1,step:.005},enableSideMask:{type:ControlType.Boolean,title:\"Side Mask\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},maskColor:{type:ControlType.Color,title:\"Mask Color\",defaultValue:\"#000000\",hidden:({enableSideMask})=>!enableSideMask},maskWidth:{type:ControlType.Number,title:\"Mask Width\",defaultValue:100,min:20,max:500,step:10,unit:\"px\",hidden:({enableSideMask})=>!enableSideMask},enableTopBottomMask:{type:ControlType.Boolean,title:\"Top/Bottom Mask\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},topBottomMaskColor:{type:ControlType.Color,title:\"Top/Bottom Mask Color\",defaultValue:\"#000000\",hidden:({enableTopBottomMask})=>!enableTopBottomMask},topBottomMaskHeight:{type:ControlType.Number,title:\"Top/Bottom Mask Height\",defaultValue:100,min:20,max:500,step:10,unit:\"px\",hidden:({enableTopBottomMask})=>!enableTopBottomMask}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WavyGridBackground\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WavyGridBackground.map"],"mappings":"oNAIG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,kBAAgB,UAAU,YAAU,UAAU,WAAS,GAAG,cAAY,GAAG,gBAAc,GAAG,gBAAc,IAAI,iBAAe,EAAE,kBAAgB,GAAM,gBAAc,EAAE,iBAAe,GAAM,YAAU,UAAU,YAAU,IAAI,sBAAoB,GAAM,qBAAmB,UAAU,sBAAoB,KAAK,EAAY,EAAUA,EAAO,KAAK,CAAO,EAAkBA,EAAO,KAAK,CAAO,EAASC,EAAY,GAAQ,CAAC,IAAM,EAAI,EAAO,WAAW,KAAK,CAAC,GAAG,CAAC,EAAI,OAAO,IAAM,EAAO,EAAO,cAAc,GAAG,CAAC,EAAO,OAC/iB,IAAM,EAAM,EAAO,YAAkB,EAAO,EAAO,aAAa,GAAG,GAAO,GAAG,GAAQ,EAAE,OAAO,IAAM,EAAI,EAAO,kBAAkB,EACjI,EAAO,MAAM,EAAM,EAAI,EAAO,OAAO,EAAO,EAC5C,EAAI,MAAM,EAAI,EAAI,CAClB,EAAO,MAAM,MAAM,EAAM,KAAK,EAAO,MAAM,OAAO,EAAO,KAAK,EAAI,UAAU,EAAE,EAAE,EAAM,EAAO,CAAC,EAAI,YAAY,EAAU,EAAI,UAAU,EAAc,EAAI,YAAY,EAC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