{"version":3,"file":"BackgroundRippleEffect_5.DKlO2oR1.mjs","names":["useState","useRef","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/riGPSQNVj3UUaaV5tC9K/9E0rZbur8u9TJh9YPTbA/BackgroundRippleEffect_5.js"],"sourcesContent":["// Interactive background ripple effect component with grid cells that animate on click\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useMemo,useRef,useState,startTransition,useCallback}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";/**\n * Interactive Background Ripple Effect\n * \n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function BackgroundRippleEffect(props){const{rows=8,cols=27,cellSize=56,borderColor=\"#E5E5E5\",fillColor=\"#F5F5F5\",shadowColor=\"#CCCCCC\",opacity=40,hoverOpacity=80,animationDuration=200,animationDelay=55,showShadow=true,interactive=true,shapeType=\"square\",layerMode=\"background\",layerZIndex=-1}=props;const[clickedCell,setClickedCell]=useState(null);const[rippleKey,setRippleKey]=useState(0);const containerRef=useRef(null);const isStatic=useIsStaticRenderer();const isInView=useInView(containerRef,{once:false,margin:\"100px\"});// Optimize for large grids by limiting cell count\nconst maxCells=1e3;const totalCells=rows*cols;const shouldVirtualize=totalCells>maxCells;const actualRows=shouldVirtualize?Math.min(rows,Math.floor(maxCells/cols)):rows;const actualCols=shouldVirtualize?Math.min(cols,Math.floor(maxCells/rows)):cols;const cells=useMemo(()=>Array.from({length:actualRows*actualCols},(_,idx)=>idx),[actualRows,actualCols]);const gridStyle={display:\"grid\",gridTemplateColumns:`repeat(${actualCols}, ${cellSize}px)`,gridTemplateRows:`repeat(${actualRows}, ${cellSize}px)`,width:actualCols*cellSize,height:actualRows*cellSize,margin:\"0 auto\",willChange:\"transform\",transform:\"translate3d(0, 0, 0)\"};const handleCellClick=useCallback((rowIdx,colIdx)=>{if(!interactive||isStatic)return;startTransition(()=>{setClickedCell({row:rowIdx,col:colIdx});setRippleKey(k=>k+1);});},[interactive,isStatic]);// Don't animate if not in view or static renderer\nconst shouldAnimate=isInView&&!isStatic;const getShapeStyles=useCallback(shape=>{const baseSize=cellSize-2// Account for border\n;switch(shape){case\"circle\":return{borderRadius:\"50%\",width:baseSize,height:baseSize};case\"triangle\":return{width:0,height:0,backgroundColor:\"transparent\",borderLeft:`${baseSize/2}px solid transparent`,borderRight:`${baseSize/2}px solid transparent`,borderBottom:`${baseSize}px solid ${fillColor}`,border:\"none\"};case\"hexagon\":return{width:baseSize,height:baseSize*.866,clipPath:\"polygon(30% 0%, 70% 0%, 100% 50%, 70% 100%, 30% 100%, 0% 50%)\"};case\"diamond\":return{width:baseSize,height:baseSize,transform:\"rotate(45deg)\",transformOrigin:\"center\"};default:return{width:baseSize,height:baseSize};}},[cellSize,fillColor]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:layerMode===\"background\"?layerZIndex:undefined,pointerEvents:layerMode===\"background\"?\"none\":\"auto\",...props.style},children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,right:0,bottom:0,zIndex:1,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",zIndex:3,...gridStyle},children:cells.map(idx=>{const rowIdx=Math.floor(idx/actualCols);const colIdx=idx%actualCols;const distance=clickedCell?Math.hypot(clickedCell.row-rowIdx,clickedCell.col-colIdx):0;const delay=clickedCell?Math.max(0,distance*animationDelay):0;const duration=animationDuration+distance*80;return /*#__PURE__*/_jsx(motion.div,{style:{position:\"relative\",backgroundColor:shapeType===\"triangle\"?\"transparent\":fillColor,border:shapeType===\"triangle\"?\"none\":`0.5px solid ${borderColor}`,opacity:opacity/100,cursor:interactive?\"pointer\":\"default\",pointerEvents:interactive?\"auto\":\"none\",willChange:shouldAnimate?\"transform, opacity\":\"auto\",transform:\"translate3d(0, 0, 0)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",...getShapeStyles(shapeType),...showShadow&&shapeType!==\"triangle\"&&{boxShadow:`0px 0px 40px 1px ${shadowColor} inset`}},onClick:()=>handleCellClick(rowIdx,colIdx),whileHover:interactive&&shouldAnimate?{opacity:hoverOpacity/100,transition:{duration:.15}}:{},animate:clickedCell&&shouldAnimate?{scale:[1,1.1,1],opacity:[opacity/100,1,opacity/100]}:{},transition:clickedCell&&shouldAnimate?{delay:delay/1e3,duration:Math.min(duration/1e3,2),ease:\"easeOut\"}:{}},`${idx}-${rippleKey}`);})})})});}addPropertyControls(BackgroundRippleEffect,{shapeType:{type:ControlType.Enum,title:\"Shape\",options:[\"square\",\"circle\",\"triangle\",\"hexagon\"],optionTitles:[\"Square\",\"Circle\",\"Triangle\",\"Hexagon\"],defaultValue:\"square\",displaySegmentedControl:false},rows:{type:ControlType.Number,title:\"Rows\",defaultValue:8,min:3,max:20,step:1,displayStepper:true},cols:{type:ControlType.Number,title:\"Columns\",defaultValue:27,min:5,max:50,step:1,displayStepper:true},cellSize:{type:ControlType.Number,title:\"Cell Size\",defaultValue:56,min:20,max:100,step:1,unit:\"px\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#E5E5E5\"},fillColor:{type:ControlType.Color,title:\"Fill Color\",defaultValue:\"#F5F5F5\"},shadowColor:{type:ControlType.Color,title:\"Shadow Color\",defaultValue:\"#CCCCCC\",hidden:({showShadow})=>!showShadow},opacity:{type:ControlType.Number,title:\"Opacity\",defaultValue:40,min:0,max:100,step:1,unit:\"%\"},hoverOpacity:{type:ControlType.Number,title:\"Hover Opacity\",defaultValue:80,min:0,max:100,step:1,unit:\"%\"},animationDuration:{type:ControlType.Number,title:\"Animation Duration\",defaultValue:200,min:50,max:1e3,step:10,unit:\"ms\"},animationDelay:{type:ControlType.Number,title:\"Animation Delay\",defaultValue:55,min:0,max:200,step:5,unit:\"ms\"},layerMode:{type:ControlType.Enum,title:\"Layer\",options:[\"background\",\"normal\"],optionTitles:[\"Background\",\"Normal\"],defaultValue:\"background\",displaySegmentedControl:true},layerZIndex:{type:ControlType.Number,title:\"Z Index\",defaultValue:-1,min:-100,max:100,step:1,displayStepper:true,hidden:({layerMode})=>layerMode!==\"background\"},showShadow:{type:ControlType.Boolean,title:\"Show Shadow\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},interactive:{type:ControlType.Boolean,title:\"Interactive\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BackgroundRippleEffect\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BackgroundRippleEffect_5.map"],"mappings":"iQAMG,SAAwB,EAAuB,EAAM,CAAC,GAAK,CAAC,OAAK,EAAE,OAAK,GAAG,WAAS,GAAG,cAAY,UAAU,YAAU,UAAU,cAAY,UAAU,UAAQ,GAAG,eAAa,GAAG,oBAAkB,IAAI,iBAAe,GAAG,aAAW,GAAK,cAAY,GAAK,YAAU,SAAS,YAAU,aAAa,cAAY,IAAI,EAAW,CAAC,EAAY,GAAgBA,EAAS,KAAK,CAAM,CAAC,EAAU,GAAcA,EAAS,EAAE,CAAO,EAAaC,EAAO,KAAK,CAAO,EAAS,GAAqB,CAAO,EAAS,EAAU,EAAa,CAAC,KAAK,GAAM,OAAO,QAAQ,CAAC,CAC1hB,EAAS,IAAqC,EAAhB,EAAK,EAAuC,EAAe,EAAW,EAAiB,KAAK,IAAI,EAAK,KAAK,MAAM,EAAS,EAAK,CAAC,CAAC,EAAW,EAAW,EAAiB,KAAK,IAAI,EAAK,KAAK,MAAM,EAAS,EAAK,CAAC,CAAC,EAAW,EAAMC,MAAY,MAAM,KAAK,CAAC,OAAO,EAAW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