PageSourceSearch

https://awt.com.tn/assets/FluidWaves-qfYU_4cD.js

js awt.com.tn collected 2026-10-05 22:40:18 UTC 5,530 bytes, 104 lines download raw bytes

1import{r as a,j as M}from"./index-CPYhWteh.js";import{u as C}from"./useIsVisible-Bo3TKdH2.js";const T=`
2  attribute vec2 a_position;
3  varying vec2 v_uv;
4  void main() {
5    v_uv = a_position * 0.5 + 0.5;
6    gl_Position = vec4(a_position, 0.0, 1.0);
7  }
8`,L=`
9  precision mediump float;
10  varying vec2 v_uv;
11  uniform float u_time;
12  uniform vec2  u_resolution;
13
14  vec3 mod289(vec3 x){return x - floor(x*(1.0/289.0))*289.0;}
15  vec2 mod289(vec2 x){return x - floor(x*(1.0/289.0))*289.0;}
16  vec3 permute(vec3 x){return mod289(((x*34.0)+1.0)*x);}
17  float snoise(vec2 v){
18    const vec4 C = vec4(0.211324865405187,0.366025403784439,
19                       -0.577350269189626,0.024390243902439);
20    vec2 i  = floor(v + dot(v, C.yy));
21    vec2 x0 = v -   i + dot(i, C.xx);
22    vec2 i1 = (x0.x > x0.y) ? vec2(1.0,0.0) : vec2(0.0,1.0);
23    vec4 x12 = x0.xyxy + C.xxzz;
24    x12.xy -= i1;
25    i = mod289(i);
26    vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))
27                              + i.x + vec3(0.0, i1.x, 1.0 ));
28    vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy),
29                                       dot(x12.zw,x12.zw)), 0.0);
30    m = m*m; m = m*m;
31    vec3 x = 2.0 * fract(p * C.www) - 1.0;
32    vec3 h = abs(x) - 0.5;
33    vec3 ox = floor(x + 0.5);
34    vec3 a0 = x - ox;
35    m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);
36    vec3 g;
37    g.x = a0.x*x0.x + h.x*x0.y;
38    g.yz = a0.yz*x12.xz + h.yz*x12.yw;
39    return 130.0 * dot(m, g);
40  }
41
42  // 3-octave fbm (reduced from 5) flowing along a moving direction
43  float fbm(vec2 p, float t){
44    float v = 0.0;
45    float amp = 0.55;
46    vec2 shift = vec2(t * 0.18, t * 0.07);
47    for(int i = 0; i < 3; i++){
48      v += amp * snoise(p + shift);
49      p = p * 2.02 + shift * 0.5;
50      amp *= 0.5;
51    }
52    return v;
53  }
54
55  vec3 palette(float t){
56    t = clamp(t, 0.0, 1.0);
57    vec3 c0 = vec3(0.04, 0.09, 0.20);
58    vec3 c1 = vec3(0.06, 0.18, 0.42);
59    vec3 c2 = vec3(0.11, 0.30, 0.65);
60    vec3 c3 = vec3(0.20, 0.55, 0.92);
61    vec3 c4 = vec3(0.55, 0.85, 1.00);
62    vec3 c5 = vec3(0.96, 0.99, 1.00);
63    if(t < 0.20) return mix(c0, c1, t / 0.20);
64    if(t < 0.40) return mix(c1, c2, (t-0.20)/0.20);
65    if(t < 0.60) return mix(c2, c3, (t-0.40)/0.20);
66    if(t < 0.80) return mix(c3, c4, (t-0.60)/0.20);
67    return            mix(c4, c5, (t-0.80)/0.20);
68  }
69
70  void main(){
71    vec2 uv = v_uv;
72    vec2 p  = uv;
73    p.x *= u_resolution.x / u_resolution.y;
74
75    float t = u_time * 0.22;
76
77    // single domain-warp (was double) for organic flow
78    vec2 q = vec2(fbm(p + vec2(0.0, 0.0), t),
79                  fbm(p + vec2(5.2, 1.3), t));
80    float n = fbm(p + 3.0*q, t);
81    n = 0.5 + 0.5 * n;
82
83    float sweep = uv.x * 0.6 - t * 0.05;
84    float band  = fract(n * 1.1 + sweep);
85    vec3 col    = palette(band);
86
87    float ridge = smoothstep(0.45, 0.95, n);
88    col += ridge * vec3(0.18, 0.12, 0.30);
89
90    float crest = smoothstep(0.78, 1.0, n);
91    col += crest * vec3(0.95, 1.0, 1.05) * 1.1;
92
93    float rightMask = smoothstep(0.05, 0.85, uv.x);
94    float alpha = rightMask;
95
96    float vy = smoothstep(0.0, 0.18, uv.y) * smoothstep(0.0, 0.18, 1.0 - uv.y);
97    alpha *= mix(0.7, 1.0, vy);
98
99    vec3 deep = vec3(0.02, 0.05, 0.12);
100    col = mix(deep, col, smoothstep(0.15, 0.85, n));
101
102    gl_FragColor = vec4(col, alpha);
103  }
104`,N=()=>{const u=a.useRef(null),o=a.useRef(),d=a.useRef(!0),s=a.useRef(null),v=C(u,"100px");return a.useEffect(()=>{d.current=v,v&&s.current&&!o.current&&(o.current=requestAnimationFrame(s.current))},[v]),a.useEffect(()=>{const t=u.current;if(!t)return;const e=t.getContext("webgl",{premultipliedAlpha:!0,antialias:!1})||t.getContext("experimental-webgl");if(!e)return;const x=(c,i)=>{const n=e.createShader(c);return e.shaderSource(n,i),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS)?n:(console.error(e.getShaderInfoLog(n)),null)},f=x(e.VERTEX_SHADER,T),l=x(e.FRAGMENT_SHADER,L);if(!f||!l)return;const r=e.createProgram();if(e.attachShader(r,f),e.attachShader(r,l),e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS)){console.error(e.getProgramInfoLog(r));return}e.useProgram(r);const p=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,p),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);const h=e.getAttribLocation(r,"a_position");e.enableVertexAttribArray(h),e.vertexAttribPointer(h,2,e.FLOAT,!1,0,0);const y=e.getUniformLocation(r,"u_time"),b=e.getUniformLocation(r,"u_resolution");e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);const g=()=>{const c=typeof window<"u"&&window.matchMedia("(pointer: coarse)").matches,i=Math.min(window.devicePixelRatio||1,c?1:1.25),n=t.clientWidth,P=t.clientHeight,_=Math.floor(n*i),R=Math.floor(P*i);(t.width!==_||t.height!==R)&&(t.width=_,t.height=R,e.viewport(0,0,t.width,t.height))};g();const w=new ResizeObserver(g);w.observe(t);const S=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=performance.now(),F=1e3/45;let A=0;const m=c=>{if(o.current=void 0,!!d.current){if(c-A>=F){A=c;const i=(c-E)/1e3;e.uniform1f(y,S?0:i),e.uniform2f(b,t.width,t.height),e.drawArrays(e.TRIANGLES,0,6)}o.current=requestAnimationFrame(m)}};
104return s.current=m,o.current=requestAnimationFrame(m),()=>{o.current&&cancelAnimationFrame(o.current),o.current=void 0,s.current=null,w.disconnect(),e.deleteBuffer(p),e.deleteProgram(r),e.deleteShader(f),e.deleteShader(l)}},[]),M.jsx("canvas",{ref:u,className:"absolute inset-0 w-full h-full",style:{display:"block"},"aria-hidden":!0})};export{N as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.