{"version":3,"file":"Ripple.g9F4eFBy.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/wNddqcZFoWLQq5SpwRor/2fXnxFOkL2cuUKkOStQA/Ripple.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef}from\"react\";// Load jQuery and Ripples.js dynamically for both preview and live site\nconst loadRippleScript=callback=>{if(!window.$){const jqueryScript=document.createElement(\"script\");jqueryScript.src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js\";jqueryScript.async=true;jqueryScript.onload=()=>{const ripplesScript=document.createElement(\"script\");ripplesScript.src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery.ripples/0.5.3/jquery.ripples.min.js\";ripplesScript.async=true;ripplesScript.onload=callback;document.body.appendChild(ripplesScript);};document.body.appendChild(jqueryScript);}else if(!window.$.fn.ripples){const ripplesScript=document.createElement(\"script\");ripplesScript.src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery.ripples/0.5.3/jquery.ripples.min.js\";ripplesScript.async=true;ripplesScript.onload=callback;document.body.appendChild(ripplesScript);}else{callback();}};/**\n *\n * @framerIntrinsicWidth 1400\n * @framerIntrinsicHeight 1000\n *\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function WebGLWaterRipples({image,intensity,rippleCount,rippleInterval,rippleSize}){const containerRef=useRef(null);useEffect(()=>{// Ensure scripts are loaded before applying the effect\nloadRippleScript(()=>{if(window.$&&typeof window.$.fn.ripples===\"function\"){console.log(\"Ripples.js is loaded. Applying effect...\");// Destroy previous instance before applying new settings\nwindow.$(containerRef.current).ripples(\"destroy\");// Map intensity\nconst mappedIntensity=.01+intensity/100*.05// Keeps it between 0.01 and 0.06\n;// Apply Ripples.js effect\nwindow.$(containerRef.current).ripples({resolution:512,perturbance:mappedIntensity,interactive:true});// Generate controlled random ripples based on user settings\nconst rippleIntervalId=setInterval(()=>{for(let i=0;i<rippleCount;i++){const $el=window.$(containerRef.current);const x=Math.random()*$el.outerWidth();const y=Math.random()*$el.outerHeight();$el.ripples(\"drop\",x,y,rippleSize,.02+Math.random()*.02);}},rippleInterval);return()=>{clearInterval(rippleIntervalId);window.$(containerRef.current).ripples(\"destroy\");};}else{console.error(\"Ripples.js failed to load.\");}});},[intensity,rippleCount,rippleInterval,rippleSize]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",backgroundImage:`url(${image})`,backgroundSize:\"cover\",backgroundPosition:\"center\",backgroundRepeat:\"no-repeat\"}});}// Framer Property Controls\naddPropertyControls(WebGLWaterRipples,{image:{type:ControlType.Image,title:\"Image\",description:\"Set your image\"},intensity:{type:ControlType.Number,title:\"Ripple Intensity\",min:1,max:10,step:1,defaultValue:3,description:\"Set an Intensity\"},rippleCount:{type:ControlType.Number,title:\"Number of Ripples\",min:1,max:10,step:1,defaultValue:2,description:\"Set ripple count\"},rippleInterval:{type:ControlType.Number,title:\"Ripple Interval (ms)\",min:1e3,max:1e4,step:500,defaultValue:4e3,description:\"Set ripple interval\"},rippleSize:{type:ControlType.Number,title:\"Ripple Size\",min:10,max:100,step:5,defaultValue:30,description:\"Set ripple size \\n \\n Made with 🖤  for [Framer](https://framer.link/harshupadhyay) by [Harsh](https://harsh.works)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WebGLWaterRipples\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"1000\",\"framerDisableUnlink\":\"*\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"1400\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Ripple.map"],"mappings":"+LAUG,SAAwB,EAAkB,CAAC,QAAM,YAAU,cAAY,iBAAe,cAAY,CAAC,IAAM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