{"version":3,"file":"ShaderFlow.gT-s62DI.mjs","names":["useRef","p"],"sources":["https:/framerusercontent.com/modules/mjdVdevUwJepCRYATQ0O/MT90t4z4eBJW8784NHo3/ShaderFlow.js"],"sourcesContent":["// Animated WebGL laser beam effect — multiple beams radiating from focal points\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Shader Flow\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ShaderFlow(props){const{beamCount=6,sourceCount=2,beamWidth=.003,glowFalloff=1.5,spread=1,speed=.3,beamColor=\"#4466FF\",backgroundColor=\"#030820\"}=props;const canvasRef=useRef(null);const propsRef=useRef({beamCount,sourceCount,beamWidth,glowFalloff,spread,speed,beamColor,backgroundColor});useEffect(()=>{propsRef.current={beamCount,sourceCount,beamWidth,glowFalloff,spread,speed,beamColor,backgroundColor};},[beamCount,sourceCount,beamWidth,glowFalloff,spread,speed,beamColor,backgroundColor]);const sceneRef=useRef({gl:null,program:null,uniforms:{},animationId:null,timeValue:0});useEffect(()=>{if(typeof window===\"undefined\")return;if(!canvasRef.current)return;if(RenderTarget.current()===RenderTarget.thumbnail)return;const canvas=canvasRef.current;const{current:refs}=sceneRef;const gl=canvas.getContext(\"webgl\",{alpha:true,antialias:true,preserveDrawingBuffer:false});if(!gl)return;refs.gl=gl;const vertexShaderSource=`\n            attribute vec2 position;\n            void main() {\n                gl_Position = vec4(position, 0.0, 1.0);\n            }\n        `;const fragmentShaderSource=`\n            precision highp float;\n            uniform vec2 resolution;\n            uniform float time;\n            uniform int beamCount;\n            uniform int sourceCount;\n            uniform float beamWidth;\n            uniform float glowFalloff;\n            uniform vec3 beamColor;\n            uniform vec3 backgroundColor;\n            uniform float spread;\n\n            #define MAX_SOURCES 3\n            #define MAX_BEAMS 8\n            #define PI 3.14159265\n\n            float rayGlow(vec2 p, vec2 o, vec2 d, float width, float falloff) {\n                vec2 op = p - o;\n                float proj = dot(op, d);\n                if (proj < 0.0) return 0.0;\n\n                vec2 closest = o + d * proj;\n                float dist = max(length(p - closest), 0.001);\n\n                float core = exp(-dist / max(width, 0.0001));\n                float glow = exp(-dist / max(width * falloff * 8.0, 0.001));\n                return core * 0.4 + glow * 0.15;\n            }\n\n            void main() {\n                vec2 p = (gl_FragCoord.xy * 2.0 - resolution) / min(resolution.x, resolution.y);\n\n                vec2 sources[MAX_SOURCES];\n                sources[0] = vec2(-0.2, 0.4) * spread;\n                sources[1] = vec2(0.6, -0.3) * spread;\n                sources[2] = vec2(-0.5, -0.5) * spread;\n\n                sources[0] += vec2(sin(time * 0.17) * 0.3, cos(time * 0.13) * 0.2) * spread;\n                sources[1] += vec2(cos(time * 0.11) * 0.25, sin(time * 0.19) * 0.3) * spread;\n                sources[2] += vec2(sin(time * 0.23) * 0.2, cos(time * 0.29) * 0.15) * spread;\n\n                float totalGlow = 0.0;\n\n                for (int s = 0; s < MAX_SOURCES; s++) {\n                    if (s >= sourceCount) break;\n\n                    float sourcePhase = float(s) * 2.399 + time * 0.2;\n\n                    for (int b = 0; b < MAX_BEAMS; b++) {\n                        if (b >= beamCount) break;\n\n                        float angle = (float(b) / float(beamCount)) * PI * 2.0\n                                    + sourcePhase\n                                    + sin(time * 0.15 + float(b) * 0.7) * 0.3;\n\n                        vec2 dir = vec2(cos(angle), sin(angle));\n                        totalGlow += rayGlow(p, sources[s], dir, beamWidth, glowFalloff);\n                    }\n                }\n\n                // Additive blending — light only adds, never darkens\n                vec3 beam = beamColor * totalGlow;\n\n                // White-hot core at beam intersections\n                float whiteness = smoothstep(0.6, 1.5, totalGlow);\n                beam += vec3(whiteness * 0.5);\n\n                // Add beam light on top of background\n                vec3 col = backgroundColor + beam;\n                col = clamp(col, 0.0, 1.0);\n\n                gl_FragColor = vec4(col, 1.0);\n            }\n        `;const createShader=(type,source)=>{const shader=gl.createShader(type);if(!shader)return null;gl.shaderSource(shader,source);gl.compileShader(shader);if(!gl.getShaderParameter(shader,gl.COMPILE_STATUS)){console.error(gl.getShaderInfoLog(shader));gl.deleteShader(shader);return null;}return shader;};const vertexShader=createShader(gl.VERTEX_SHADER,vertexShaderSource);const fragmentShader=createShader(gl.FRAGMENT_SHADER,fragmentShaderSource);if(!vertexShader||!fragmentShader)return;const program=gl.createProgram();if(!program)return;gl.attachShader(program,vertexShader);gl.attachShader(program,fragmentShader);gl.linkProgram(program);if(!gl.getProgramParameter(program,gl.LINK_STATUS)){console.error(gl.getProgramInfoLog(program));return;}refs.program=program;gl.useProgram(program);const positions=new Float32Array([-1,-1,1,-1,-1,1,1,-1,-1,1,1,1]);const positionBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,positionBuffer);gl.bufferData(gl.ARRAY_BUFFER,positions,gl.STATIC_DRAW);const positionLocation=gl.getAttribLocation(program,\"position\");gl.enableVertexAttribArray(positionLocation);gl.vertexAttribPointer(positionLocation,2,gl.FLOAT,false,0,0);const uniformNames=[\"resolution\",\"time\",\"beamCount\",\"sourceCount\",\"beamWidth\",\"glowFalloff\",\"spread\",\"beamColor\",\"backgroundColor\"];for(const name of uniformNames){refs.uniforms[name]=gl.getUniformLocation(program,name);}const parseColor=color=>{if(!color)return{r:1,g:1,b:1};const rgbaMatch=color.match(/rgba?\\(\\s*(\\d+),\\s*(\\d+),\\s*(\\d+)/);if(rgbaMatch){return{r:parseInt(rgbaMatch[1])/255,g:parseInt(rgbaMatch[2])/255,b:parseInt(rgbaMatch[3])/255};}const cleaned=color.replace(\"#\",\"\").trim();const isShort=cleaned.length===3;const full=isShort?cleaned.split(\"\").map(c=>c+c).join(\"\"):cleaned;if(full.length!==6)return{r:1,g:1,b:1};const num=parseInt(full,16);return{r:(num>>16&255)/255,g:(num>>8&255)/255,b:(num&255)/255};};const updateSize=()=>{if(!canvas||!gl||!refs.uniforms.resolution)return;const rect=canvas.getBoundingClientRect();const dpr=window.devicePixelRatio||1;const width=Math.round(rect.width*dpr);const height=Math.round(rect.height*dpr);if(canvas.width!==width||canvas.height!==height){canvas.width=width;canvas.height=height;gl.viewport(0,0,width,height);}gl.uniform2f(refs.uniforms.resolution,width,height);};// Use ResizeObserver for reliable sizing in Framer\nlet resizeObserver=null;if(typeof ResizeObserver!==\"undefined\"){resizeObserver=new ResizeObserver(()=>updateSize());resizeObserver.observe(canvas);}window.addEventListener(\"resize\",updateSize);updateSize();const animate=()=>{if(!gl||!refs.program||!refs.uniforms.time)return;const p=propsRef.current;refs.timeValue+=p.speed*.016;updateSize();gl.uniform1f(refs.uniforms.time,refs.timeValue);gl.uniform1i(refs.uniforms.beamCount,Math.min(p.beamCount,8));gl.uniform1i(refs.uniforms.sourceCount,Math.min(p.sourceCount,3));gl.uniform1f(refs.uniforms.beamWidth,p.beamWidth);gl.uniform1f(refs.uniforms.glowFalloff,p.glowFalloff);gl.uniform1f(refs.uniforms.spread,p.spread);if(refs.uniforms.beamColor){const c=parseColor(p.beamColor);gl.uniform3f(refs.uniforms.beamColor,c.r,c.g,c.b);}if(refs.uniforms.backgroundColor){const c=parseColor(p.backgroundColor);gl.uniform3f(refs.uniforms.backgroundColor,c.r,c.g,c.b);gl.clearColor(c.r,c.g,c.b,1);}gl.clear(gl.COLOR_BUFFER_BIT);gl.drawArrays(gl.TRIANGLES,0,6);refs.animationId=requestAnimationFrame(animate);};animate();return()=>{if(refs.animationId)cancelAnimationFrame(refs.animationId);window.removeEventListener(\"resize\",updateSize);if(resizeObserver)resizeObserver.disconnect();if(gl&&refs.program)gl.deleteProgram(refs.program);if(gl&&vertexShader)gl.deleteShader(vertexShader);if(gl&&fragmentShader)gl.deleteShader(fragmentShader);};},[]);if(RenderTarget.current()===RenderTarget.thumbnail){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:\"#4466FF\",fontSize:14,fontFamily:\"sans-serif\"},children:\"Laser Beams\"});}return /*#__PURE__*/_jsx(\"canvas\",{ref:canvasRef,style:{width:\"100%\",height:\"100%\",display:\"block\",backgroundColor}});}addPropertyControls(ShaderFlow,{sourceCount:{type:ControlType.Number,title:\"Sources\",defaultValue:2,min:1,max:3,step:1},beamCount:{type:ControlType.Number,title:\"Beams per Source\",defaultValue:6,min:2,max:8,step:1},beamWidth:{type:ControlType.Number,title:\"Beam Width\",defaultValue:.003,min:.001,max:.02,step:.001},glowFalloff:{type:ControlType.Number,title:\"Glow Spread\",defaultValue:1.5,min:.5,max:5,step:.1},spread:{type:ControlType.Number,title:\"Source Spread\",defaultValue:1,min:0,max:3,step:.1},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:.3,min:0,max:2,step:.05},beamColor:{type:ControlType.Color,title:\"Beam Color\",defaultValue:\"#4466FF\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#030820\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ShaderFlow\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ShaderFlow.map"],"mappings":"iMAMG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,YAAU,EAAE,cAAY,EAAE,YAAU,KAAK,cAAY,IAAI,SAAO,EAAE,QAAM,GAAG,YAAU,UAAU,kBAAgB,WAAW,EAAY,EAAUA,EAAO,KAAK,CAAO,EAASA,EAAO,CAAC,YAAU,cAAY,YAAU,cAAY,SAAO,QAAM,YAAU,kBAAgB,CAAC,CAAC,MAAc,CAAC,EAAS,QAAQ,CAAC,YAAU,cAAY,YAAU,cAAY,SAAO,QAAM,YAAU,kBAAgB,EAAG,CAAC,EAAU,EAAY,EAAU,EAAY,EAAO,EAAM,EAAU,EAAgB,CAAC,CAAC,IAAM,EAASA,EAAO,CAAC,GAAG,KAAK,QAAQ,KAAK,SAAS,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