{"version":3,"file":"Divider_section.DxFGfxhh.mjs","names":["React.useRef"],"sources":["https:/framerusercontent.com/modules/MSfpYCZ2vglXoyBixlhs/3Pk7JnUHZsefijDKLWQU/Divider_section.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerIntrinsicWidth 100%\n * @framerIntrinsicHeight 100\n */export default function PixelDivider(props){const{blockSize,color,density,seed,alignment}=props;const canvasRef=React.useRef(null);// A simple pseudo-random function that is deterministic based on coordinates\n// This ensures the pattern doesn't \"dance\" when you resize the window\nconst pseudoRandom=(x,y)=>{const val=Math.sin(x*12.9898+y*78.233+seed)*43758.5453;return val-Math.floor(val);};React.useEffect(()=>{const canvas=canvasRef.current;const ctx=canvas.getContext(\"2d\");const render=()=>{// 1. Setup Canvas Dimensions\nconst parent=canvas.parentElement;const width=parent?parent.clientWidth:window.innerWidth;const height=parent?parent.clientHeight:200;// Handle high-DPI displays for crisp pixels\nconst dpr=window.devicePixelRatio||1;canvas.width=width*dpr;canvas.height=height*dpr;canvas.style.width=`${width}px`;canvas.style.height=`${height}px`;ctx.scale(dpr,dpr);// 2. Clear\nctx.clearRect(0,0,width,height);// 3. Draw Grid\n// Calculate how many rows/cols fit\nconst cols=Math.ceil(width/blockSize);const rows=Math.ceil(height/blockSize);ctx.fillStyle=color;for(let y=0;y<rows;y++){for(let x=0;x<cols;x++){// Generate random value for this specific cell\nconst rand=pseudoRandom(x,y);// If the random value is less than density, draw the block\nif(rand<density/100){// ALIGNMENT LOGIC\n// If 'Bottom' align, we draw from bottom up\nlet drawY=y*blockSize;if(alignment===\"bottom\"){// Invert Y calculation to stick to bottom\nconst totalHeight=rows*blockSize;const offset=height-totalHeight// Push to bottom edge\n;drawY=offset+y*blockSize;}ctx.fillRect(x*blockSize,drawY,blockSize,blockSize);}}}};render();window.addEventListener(\"resize\",render);return()=>window.removeEventListener(\"resize\",render);},[blockSize,color,density,seed,alignment]);return /*#__PURE__*/_jsx(\"canvas\",{ref:canvasRef,style:{width:\"100%\",height:\"100%\",display:\"block\"}});}addPropertyControls(PixelDivider,{color:{type:ControlType.Color,title:\"Color\",defaultValue:\"2216FF\"},blockSize:{type:ControlType.Number,title:\"Block Size\",defaultValue:40,min:10,max:100,step:5},density:{type:ControlType.Number,title:\"Density %\",defaultValue:50,min:0,max:100,description:\"Amount of pixels filled\"},alignment:{type:ControlType.Enum,title:\"Align\",defaultValue:\"top\",options:[\"top\",\"bottom\"],optionTitles:[\"Top\",\"Bottom\"],description:\"Anchor to top or bottom edge\"},seed:{type:ControlType.Number,title:\"Pattern Seed\",defaultValue:123,min:1,max:999,description:\"Change this number to shuffle the pattern\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PixelDivider\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"100\",\"framerIntrinsicWidth\":\"100%\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Divider_section.map"],"mappings":"2LAGG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,YAAU,QAAM,UAAQ,OAAK,aAAW,EAAY,EAAUA,EAAa,KAAK,CAE/H,GAAc,EAAE,IAAI,CAAC,IAAM,EAAI,KAAK,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAK,CAAC,WAAW,OAAO,EAAI,KAAK,MAAM,EAAI,EAW4H,OAXzH,MAAoB,CAAC,IAAM,EAAO,EAAU,QAAc,EAAI,EAAO,WAAW,KAAK,CAAO,MAAW,CACtN,IAAM,EAAO,EAAO,cAAoB,EAAM,EAAO,EAAO,YAAY,EAAO,WAAiB,EAAO,EAAO,EAAO,aAAa,IAC5H,EAAI,EAAO,kBAAkB,EAAE,EAAO,MAAM,EAAM,EAAI,EAAO,OAAO,EAAO,EAAI,EAAO,MAAM,MAAM,GAAG,EAAM,IAAI,EAAO,MAAM,OAAO,GAAG,EAAO,I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