{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/kk41xdT05LvznKay3m6R/PzZ6Q7190x1O2NGXJTdi/GradientSmoothingComponent.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import*as React from\"react\";// Define the component with dithering options\nexport function GradientSmoothingComponent(props){const{noiseAmount,ditheringType}=props;const canvasRef=React.useRef(null);// Ordered Dithering matrix (Bayer 2x2)\nconst bayerMatrix=[[0,2],[3,1]];const applyUnorderedDithering=(data,width,height)=>{for(let i=0;i<data.length;i+=4){const randomNoise=noiseAmount*255*(Math.random()-.5);data[i]+=randomNoise// Red\n;data[i+1]+=randomNoise// Green\n;data[i+2]+=randomNoise// Blue\n;}};const applyOrderedDithering=(data,width,height)=>{for(let y=0;y<height;y++){for(let x=0;x<width;x++){const index=(y*width+x)*4;const threshold=bayerMatrix[y%2][x%2]/4-.5;const noise=noiseAmount*255*threshold;data[index]+=noise// Red\n;data[index+1]+=noise// Green\n;data[index+2]+=noise// Blue\n;}}};React.useEffect(()=>{const canvas=canvasRef.current;if(!canvas)return;const ctx=canvas.getContext(\"2d\");const width=canvas.width;const height=canvas.height;const imageData=ctx.createImageData(width,height);const data=imageData.data;// Apply the correct dithering type\nif(ditheringType===\"unordered\"){applyUnorderedDithering(data,width,height);}else{applyOrderedDithering(data,width,height);}// Apply the altered imageData to the canvas\nctx.putImageData(imageData,0,0);},[noiseAmount,ditheringType]);return /*#__PURE__*/_jsx(\"canvas\",{ref:canvasRef,width:500,height:500,style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",zIndex:9999}});}// Add property controls for noiseAmount and dithering type\naddPropertyControls(GradientSmoothingComponent,{noiseAmount:{type:ControlType.Number,title:\"Noise Amount\",defaultValue:.2,min:0,max:1,step:.01,displayStepper:true},ditheringType:{type:ControlType.Enum,title:\"Dithering Type\",options:[\"unordered\",\"ordered\"],optionTitles:[\"Unordered\",\"Ordered\"],defaultValue:\"unordered\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"GradientSmoothingComponent\":{\"type\":\"reactComponent\",\"name\":\"GradientSmoothingComponent\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GradientSmoothingComponent.map"],
  "mappings": "iEACO,SAASA,EAA2BC,EAAM,CAAC,GAAK,CAAC,YAAAC,EAAY,cAAAC,CAAa,EAAEF,EAAYG,EAAgBC,EAAO,IAAI,EACpHC,EAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAQC,EAAwB,CAACC,EAAKC,EAAMC,IAAS,CAAC,QAAQC,EAAE,EAAEA,EAAEH,EAAK,OAAOG,GAAG,EAAE,CAAC,IAAMC,EAAYV,EAAY,KAAK,KAAK,OAAO,EAAE,IAAIM,EAAKG,CAAC,GAAGC,EACjLJ,EAAKG,EAAE,CAAC,GAAGC,EACXJ,EAAKG,EAAE,CAAC,GAAGC,CACX,CAAC,EAAQC,EAAsB,CAACL,EAAKC,EAAMC,IAAS,CAAC,QAAQI,EAAE,EAAEA,EAAEJ,EAAOI,IAAK,QAAQC,EAAE,EAAEA,EAAEN,EAAMM,IAAI,CAAC,IAAMC,GAAOF,EAAEL,EAAMM,GAAG,EAAQE,EAAUX,EAAYQ,EAAE,CAAC,EAAEC,EAAE,CAAC,EAAE,EAAE,GAASG,EAAMhB,EAAY,IAAIe,EAAUT,EAAKQ,CAAK,GAAGE,EAChOV,EAAKQ,EAAM,CAAC,GAAGE,EACfV,EAAKQ,EAAM,CAAC,GAAGE,CACf,CAAE,EAAE,OAAMC,EAAU,IAAI,CAAC,IAAMC,EAAOhB,EAAU,QAAQ,GAAG,CAACgB,EAAO,OAAO,IAAMC,EAAID,EAAO,WAAW,IAAI,EAAQX,EAAMW,EAAO,MAAYV,EAAOU,EAAO,OAAaE,EAAUD,EAAI,gBAAgBZ,EAAMC,CAAM,EAAQF,EAAKc,EAAU,KACrOnB,IAAgB,YAAaI,EAAwBC,EAAKC,EAAMC,CAAM,EAAQG,EAAsBL,EAAKC,EAAMC,CAAM,EACxHW,EAAI,aAAaC,EAAU,EAAE,CAAC,CAAE,EAAE,CAACpB,EAAYC,CAAa,CAAC,EAAsBoB,EAAK,SAAS,CAAC,IAAInB,EAAU,MAAM,IAAI,OAAO,IAAI,MAAM,CAAC,SAAS,WAAW,IAAI,EAAE,KAAK,EAAE,MAAM,OAAO,OAAO,OAAO,OAAO,IAAI,CAAC,CAAC,CAAE,CACvNoB,EAAoBxB,EAA2B,CAAC,YAAY,CAAC,KAAKyB,EAAY,OAAO,MAAM,eAAe,aAAa,GAAG,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,eAAe,EAAI,EAAE,cAAc,CAAC,KAAKA,EAAY,KAAK,MAAM,iBAAiB,QAAQ,CAAC,YAAY,SAAS,EAAE,aAAa,CAAC,YAAY,SAAS,EAAE,aAAa,WAAW,CAAC,CAAC",
  "names": ["GradientSmoothingComponent", "props", "noiseAmount", "ditheringType", "canvasRef", "pe", "bayerMatrix", "applyUnorderedDithering", "data", "width", "height", "i", "randomNoise", "applyOrderedDithering", "y", "x", "index", "threshold", "noise", "ue", "canvas", "ctx", "imageData", "p", "addPropertyControls", "ControlType"]
}
