{"version":3,"file":"TwinklingPlusPattern.DGSXuDSN.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/W4I53cIgriUNNz4KsNmR/wwQrpGA4l1Bjc6aUlgsp/TwinklingPlusPattern.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType,Frame}from\"framer\";export default function TwinklingPlusPattern({twinkleSpeed,twinkleAmount,twinkleColor,useGradient,gradientStart,gradientEnd,patternScale,startColor}){// Overall fixed dimensions.\nconst width=5e3;const height=2e3;// Base cell size (18px) multiplied by patternScale.\nconst baseCellSize=18;const cellSize=baseCellSize*patternScale;// Calculate how many cells are needed to fill the area.\nconst columns=Math.ceil(width/cellSize);const rows=Math.ceil(height/cellSize);const totalCells=columns*rows;// twinkleState: each index corresponds to a cell.\n// false = overlay hidden (base color only), true = overlay shown.\nconst[twinkleState,setTwinkleState]=useState(Array(totalCells).fill(false));// If the grid size changes, reset the state.\nuseEffect(()=>{setTwinkleState(Array(totalCells).fill(false));},[totalCells]);// On each interval, update state so that exactly `twinkleAmount` cells are active.\nuseEffect(()=>{const interval=setInterval(()=>{// Create a new state array with all cells set to false.\nconst newState=Array(totalCells).fill(false);// Clamp the count so it does not exceed the number of cells.\nconst count=Math.min(twinkleAmount,totalCells);// Create an array of cell indices.\nconst indices=Array.from({length:totalCells},(_,i)=>i);// Shuffle the array using Fisher–Yates.\nfor(let i=indices.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[indices[i],indices[j]]=[indices[j],indices[i]];}// Activate exactly `count` cells.\nfor(let k=0;k<count;k++){newState[indices[k]]=true;}setTwinkleState(newState);},twinkleSpeed);return()=>clearInterval(interval);},[twinkleSpeed,totalCells,twinkleAmount]);return /*#__PURE__*/_jsx(Frame,{width:width,height:height,background:\"transparent\",children:/*#__PURE__*/_jsxs(\"svg\",{width:\"100%\",height:\"100%\",viewBox:`0 0 ${width} ${height}`,// Disable text selection and pointer events.\nstyle:{userSelect:\"none\",MozUserSelect:\"none\",WebkitUserSelect:\"none\",msUserSelect:\"none\",pointerEvents:\"none\"},children:[useGradient&&/*#__PURE__*/_jsx(\"defs\",{children:/*#__PURE__*/_jsxs(\"linearGradient\",{id:\"gradient\",x1:\"0%\",y1:\"0%\",x2:\"100%\",y2:\"100%\",children:[/*#__PURE__*/_jsx(\"stop\",{offset:\"0%\",stopColor:gradientStart}),/*#__PURE__*/_jsx(\"stop\",{offset:\"100%\",stopColor:gradientEnd})]})}),/*#__PURE__*/_jsx(\"style\",{children:`\n                        .plus-overlay {\n                            transition: opacity 1s ease-in-out;\n                            will-change: opacity;\n                            opacity: 0;\n                        }\n                        .plus-overlay.active {\n                            opacity: 1;\n                        }\n                    `}),twinkleState.map((isTwinkling,index)=>{const col=index%columns;const row=Math.floor(index/columns);// Center the plus mark within its cell.\nconst x=col*cellSize+cellSize/2;const y=row*cellSize+cellSize/2;return /*#__PURE__*/_jsxs(\"g\",{children:[/*#__PURE__*/_jsx(\"text\",{x:x,y:y,fontSize:cellSize,textAnchor:\"middle\",dominantBaseline:\"middle\",fill:startColor,children:\"+\"}),/*#__PURE__*/_jsx(\"text\",{x:x,y:y,fontSize:cellSize,textAnchor:\"middle\",dominantBaseline:\"middle\",fill:useGradient?\"url(#gradient)\":twinkleColor,className:`plus-overlay ${isTwinkling?\"active\":\"\"}`,children:\"+\"})]},index);})]})});}addPropertyControls(TwinklingPlusPattern,{twinkleSpeed:{type:ControlType.Number,title:\"Twinkle Speed (ms)\",defaultValue:2e3,min:500,max:5e3,step:100},twinkleAmount:{type:ControlType.Number,title:\"Twinkle Amount (count)\",defaultValue:3,min:1,max:100,step:1},twinkleColor:{type:ControlType.Color,title:\"Twinkle Color\",defaultValue:\"#ffdd57\"},useGradient:{type:ControlType.Boolean,title:\"Use Gradient\",defaultValue:false},gradientStart:{type:ControlType.Color,title:\"Gradient Start\",defaultValue:\"#ffdd57\",hidden:({useGradient})=>!useGradient},gradientEnd:{type:ControlType.Color,title:\"Gradient End\",defaultValue:\"#ffffff\",hidden:({useGradient})=>!useGradient},patternScale:{type:ControlType.Number,title:\"Pattern Scale\",defaultValue:1,min:.1,max:3,step:.1},startColor:{type:ControlType.Color,title:\"Start Color\",defaultValue:\"#333\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TwinklingPlusPattern\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TwinklingPlusPattern.map"],"mappings":"4RAAyJ,SAAwB,EAAqB,CAAC,eAAa,gBAAc,eAAa,cAAY,gBAAc,cAAY,eAAa,cAAY,CAC9S,IAAM,EAAM,IAAU,EAAO,IACD,EAAT,GAA+B,EAC5C,EAAQ,KAAK,KAAK,EAAM,EAAS,CAAO,EAAK,KAAK,KAAK,EAAO,EAAS,CAAO,EAAW,EAAQ,EAElG,CAAC,EAAa,GAAiBA,EAAS,MAAM,EAAW,CAAC,KAAK,GAAM,CAAC,CAOgG,OAN3K,MAAc,CAAC,EAAgB,MAAM,EAAW,CAAC,KAAK,GAAM,CAAC,EAAG,CAAC,EAAW,CAAC,CAC7E,MAAc,CAAC,IAAM,EAAS,gBAAgB,CAC9C,IAAM,EAAS,MAAM,EAAW,CAAC,KAAK,GAAM,CACtC,EAAM,KAAK,IAAI,EAAc,EAAW,CACxC,EAAQ,MAAM,KAAK,CAAC,OAAO,EAAW,EAAE,EAAE,IAAI,EAAE,CACtD,IAAI,IAAI,EAAE,EAAQ,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,IAAM,EAAE,KAAK,MAAM,KAAK,QAAQ,EAAE,EAAE,GAAG,CAAC,CAAC,EAAQ,GAAG,EAAQ,IAAI,CAAC,EAAQ,GAAG,EAAQ,GAAG,CAC3H,IAAI,IAAI,EAAE,EAAE,EAAE,EAAM,IAAK,EAAS,EAAQ,IAAI,GAAM,EAAgB,EAAS,EAAG,EA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