@rippleflow/water-distortion 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -132,7 +132,6 @@ uniform sampler2D u_background;
132
132
  uniform sampler2D u_causticMap;
133
133
  uniform vec2 u_texel;
134
134
  uniform float u_domMode;
135
- uniform float u_textureEnabled;
136
135
  uniform float u_normalScale;
137
136
  uniform float u_refractionStrength;
138
137
  uniform float u_specularIntensity;
@@ -144,18 +143,6 @@ const float DOM_CAUSTIC_GAIN = ${fe.causticGain.toFixed(2)};
144
143
  const float DOM_SCREEN_COMPENSATION = ${fe.screenCompensation.toFixed(2)};
145
144
  const float DOM_MAX_ALPHA = ${fe.maxAlpha.toFixed(2)};
146
145
 
147
- vec3 proceduralBackground(vec2 uv) {
148
- vec3 deep = vec3(0.055, 0.075, 0.070);
149
- vec3 teal = vec3(0.060, 0.320, 0.310);
150
- vec3 coral = vec3(0.680, 0.230, 0.190);
151
- vec3 gold = vec3(0.850, 0.710, 0.360);
152
- float diagonal = smoothstep(0.05, 0.95, uv.x * 0.72 + uv.y * 0.28);
153
- vec3 color = mix(deep, teal, diagonal);
154
- color = mix(color, coral, smoothstep(0.18, 0.76, uv.x - uv.y * 0.18) * 0.36);
155
- color = mix(color, gold, smoothstep(0.58, 1.0, uv.y + uv.x * 0.16) * 0.24);
156
- return color;
157
- }
158
-
159
146
  vec4 causticLayer(vec2 uv, vec2 bend, mat2 rotation, float scale, vec2 drift) {
160
147
  vec2 p = rotation * (uv * scale + drift * u_time);
161
148
 
@@ -180,9 +167,7 @@ void main() {
180
167
  vec2(0.999)
181
168
  );
182
169
 
183
- vec3 base = u_textureEnabled > 0.5
184
- ? texture2D(u_background, refractedUv).rgb
185
- : proceduralBackground(refractedUv);
170
+ vec3 base = texture2D(u_background, refractedUv).rgb;
186
171
 
187
172
  float gradient = length(vec2(dx, dy)) * u_normalScale;
188
173
  float crest = smoothstep(0.012, 0.24, gradient);
@@ -309,8 +294,8 @@ class rt {
309
294
  this.cssWidth = Math.max(1, e), this.cssHeight = Math.max(1, n);
310
295
  const a = Math.min(2, Math.max(1, t || 1)), l = Math.max(1, Math.round(this.cssWidth * a)), c = Math.max(1, Math.round(this.cssHeight * a));
311
296
  (this.canvas.width !== l || this.canvas.height !== c) && (this.canvas.width = l, this.canvas.height = c);
312
- const s = Math.max(32, Math.round(i)), d = this.cssWidth / this.cssHeight, E = d >= 1 ? s : Math.max(1, Math.round(s * d)), _ = d >= 1 ? Math.max(1, Math.round(s / d)) : s;
313
- E === this.simWidth && _ === this.simHeight || (this.simWidth = E, this.simHeight = _, this.recreateState());
297
+ const s = Math.max(32, Math.round(i)), d = this.cssWidth / this.cssHeight, E = d >= 1 ? s : Math.max(1, Math.round(s * d)), p = d >= 1 ? Math.max(1, Math.round(s / d)) : s;
298
+ E === this.simWidth && p === this.simHeight || (this.simWidth = E, this.simHeight = p, this.recreateState());
314
299
  }
315
300
  setTextureSource(e) {
316
301
  if (e === this.textureSource || (this.textureSource = e, this.textureImage = void 0, this.textureReady = !1, this.textureNeedsUpload = !1, !e))
@@ -334,7 +319,7 @@ class rt {
334
319
  }
335
320
  render(e, n = 0) {
336
321
  const t = this.gl;
337
- this.stateTextures && (e.texture ? this.setTextureSource(e.texture) : this.setTextureSource(void 0), this.uploadTextureIfNeeded(e), t.useProgram(this.materialProgram.program), t.bindFramebuffer(t.FRAMEBUFFER, null), t.viewport(0, 0, this.canvas.width, this.canvas.height), t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), !(e.mode !== "dom" && e.texture && !this.textureReady) && (t.activeTexture(t.TEXTURE0), t.bindTexture(t.TEXTURE_2D, this.stateTextures[this.readIndex]), t.activeTexture(t.TEXTURE1), t.bindTexture(t.TEXTURE_2D, this.backgroundTexture), t.activeTexture(t.TEXTURE2), t.bindTexture(t.TEXTURE_2D, this.causticTexture), this.prepareQuad(this.materialProgram), this.setMaterialUniforms(e, n), t.drawArrays(t.TRIANGLE_STRIP, 0, 4)));
322
+ this.stateTextures && (e.texture ? this.setTextureSource(e.texture) : this.setTextureSource(void 0), this.uploadTextureIfNeeded(e), t.useProgram(this.materialProgram.program), t.bindFramebuffer(t.FRAMEBUFFER, null), t.viewport(0, 0, this.canvas.width, this.canvas.height), t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), !(e.mode !== "dom" && !this.textureReady) && (t.activeTexture(t.TEXTURE0), t.bindTexture(t.TEXTURE_2D, this.stateTextures[this.readIndex]), t.activeTexture(t.TEXTURE1), t.bindTexture(t.TEXTURE_2D, this.backgroundTexture), t.activeTexture(t.TEXTURE2), t.bindTexture(t.TEXTURE_2D, this.causticTexture), this.prepareQuad(this.materialProgram), this.setMaterialUniforms(e, n), t.drawArrays(t.TRIANGLE_STRIP, 0, 4)));
338
323
  }
339
324
  hasVisibleActivity() {
340
325
  if (!this.framebuffers)
@@ -482,18 +467,15 @@ class rt {
482
467
  setSimulationUniforms(e, n, t) {
483
468
  const i = this.gl, a = this.simulationProgram.program, l = Math.min(e.length, J), c = this.wakeAUniforms, s = this.wakeBUniforms, d = this.wakeShapeUniforms, E = Math.max(0, e.length - J);
484
469
  c.fill(0), s.fill(0), d.fill(0);
485
- for (let _ = 0; _ < l; _ += 1) {
486
- const m = e[E + _], v = _ * 4;
470
+ for (let p = 0; p < l; p += 1) {
471
+ const m = e[E + p], v = p * 4;
487
472
  c[v] = m.ax, c[v + 1] = m.ay, c[v + 2] = m.radius, c[v + 3] = m.wakeStrength, s[v] = m.bx, s[v + 1] = m.by, s[v + 2] = m.wakeLength, s[v + 3] = m.velocity, d[v] = m.troughStrength, d[v + 1] = m.ridgeStrength, d[v + 2] = m.ridgeOffset;
488
473
  }
489
- i.uniform1i(p(i, a, "u_state"), 0), i.uniform2f(p(i, a, "u_texel"), 1 / this.simWidth, 1 / this.simHeight), i.uniform1f(p(i, a, "u_delta"), t), i.uniform1f(p(i, a, "u_damping"), n.damping), i.uniform1f(p(i, a, "u_stiffness"), n.waveSpeed), i.uniform1f(p(i, a, "u_aspect"), this.cssWidth / this.cssHeight), i.uniform1i(p(i, a, "u_wakeCount"), l), i.uniform4fv(p(i, a, "u_wakeA[0]"), c), i.uniform4fv(p(i, a, "u_wakeB[0]"), s), i.uniform4fv(p(i, a, "u_wakeShape[0]"), d);
474
+ i.uniform1i(S(i, a, "u_state"), 0), i.uniform2f(S(i, a, "u_texel"), 1 / this.simWidth, 1 / this.simHeight), i.uniform1f(S(i, a, "u_delta"), t), i.uniform1f(S(i, a, "u_damping"), n.damping), i.uniform1f(S(i, a, "u_stiffness"), n.waveSpeed), i.uniform1f(S(i, a, "u_aspect"), this.cssWidth / this.cssHeight), i.uniform1i(S(i, a, "u_wakeCount"), l), i.uniform4fv(S(i, a, "u_wakeA[0]"), c), i.uniform4fv(S(i, a, "u_wakeB[0]"), s), i.uniform4fv(S(i, a, "u_wakeShape[0]"), d);
490
475
  }
491
476
  setMaterialUniforms(e, n) {
492
- const t = this.gl, i = this.materialProgram.program, a = e.mode !== "dom";
493
- t.uniform1i(p(t, i, "u_state"), 0), t.uniform1i(p(t, i, "u_background"), 1), t.uniform1i(p(t, i, "u_causticMap"), 2), t.uniform2f(p(t, i, "u_texel"), 1 / this.simWidth, 1 / this.simHeight), t.uniform1f(p(t, i, "u_domMode"), e.mode === "dom" ? 1 : 0), t.uniform1f(
494
- p(t, i, "u_textureEnabled"),
495
- a && this.textureReady ? 1 : 0
496
- ), t.uniform1f(p(t, i, "u_normalScale"), e.normalScale), t.uniform1f(p(t, i, "u_refractionStrength"), e.refractionStrength), t.uniform1f(p(t, i, "u_specularIntensity"), e.specularIntensity), t.uniform1f(p(t, i, "u_crestIntensity"), e.crestIntensity), t.uniform1f(p(t, i, "u_causticIntensity"), e.causticIntensity), t.uniform1f(p(t, i, "u_time"), n % 1e3);
477
+ const t = this.gl, i = this.materialProgram.program;
478
+ t.uniform1i(S(t, i, "u_state"), 0), t.uniform1i(S(t, i, "u_background"), 1), t.uniform1i(S(t, i, "u_causticMap"), 2), t.uniform2f(S(t, i, "u_texel"), 1 / this.simWidth, 1 / this.simHeight), t.uniform1f(S(t, i, "u_domMode"), e.mode === "dom" ? 1 : 0), t.uniform1f(S(t, i, "u_normalScale"), e.normalScale), t.uniform1f(S(t, i, "u_refractionStrength"), e.refractionStrength), t.uniform1f(S(t, i, "u_specularIntensity"), e.specularIntensity), t.uniform1f(S(t, i, "u_crestIntensity"), e.crestIntensity), t.uniform1f(S(t, i, "u_causticIntensity"), e.causticIntensity), t.uniform1f(S(t, i, "u_time"), n % 1e3);
497
479
  }
498
480
  }
499
481
  function nt() {
@@ -507,13 +489,13 @@ function nt() {
507
489
  }
508
490
  function ce(r, e, n) {
509
491
  const t = Math.sin(se * (e * 2 + n * 0.013)) * 0.12 + Math.sin(se * (r * 3 + e + n * 0.021)) * 0.06, i = Math.cos(se * (r * 2 + n * 0.017)) * 0.12 + Math.sin(se * (e * 3 - r + n * 0.019)) * 0.06, a = r * oe + t, l = e * oe + i, c = Math.floor(a), s = Math.floor(l);
510
- let d = Number.POSITIVE_INFINITY, E = Number.POSITIVE_INFINITY, _ = 0, m = 0;
492
+ let d = Number.POSITIVE_INFINITY, E = Number.POSITIVE_INFINITY, p = 0, m = 0;
511
493
  for (let P = -1; P <= 1; P += 1)
512
- for (let U = -1; U <= 1; U += 1) {
513
- const k = c + U, B = s + P, M = Ie(k, oe), I = Ie(B, oe), z = k + 0.16 + me(M, I, n) * 0.68, N = B + 0.16 + me(M, I, n + 1) * 0.68, D = Math.hypot(a - z, l - N);
514
- D < d ? (E = d, d = D, _ = M, m = I) : D < E && (E = D);
494
+ for (let D = -1; D <= 1; D += 1) {
495
+ const k = c + D, B = s + P, M = Ie(k, oe), I = Ie(B, oe), z = k + 0.16 + me(M, I, n) * 0.68, N = B + 0.16 + me(M, I, n + 1) * 0.68, U = Math.hypot(a - z, l - N);
496
+ U < d ? (E = d, d = U, p = M, m = I) : U < E && (E = U);
515
497
  }
516
- const v = E - d, A = 1 - Fe(0.025, 0.13, v), w = 1 - Fe(0.08, 0.34, v), W = 0.74 + me(_, m, n + 2) * 0.26, H = A * A * 0.58 + w * 0.34;
498
+ const v = E - d, A = 1 - Fe(0.025, 0.13, v), w = 1 - Fe(0.08, 0.34, v), W = 0.74 + me(p, m, n + 2) * 0.26, H = A * A * 0.58 + w * 0.34;
517
499
  return We(Math.pow(H * W, 1.12));
518
500
  }
519
501
  function me(r, e, n) {
@@ -581,7 +563,7 @@ function ke(r, e, n) {
581
563
  }
582
564
  return t;
583
565
  }
584
- function p(r, e, n) {
566
+ function S(r, e, n) {
585
567
  const t = r.getUniformLocation(e, n);
586
568
  if (!t)
587
569
  throw new Error(`WaterDistortion could not bind uniform ${n}.`);
@@ -602,8 +584,8 @@ function ot(r, e, n, t = Je) {
602
584
  const l = (c, s) => r[(s * i + c) * 4] ?? 0;
603
585
  for (let c = 0; c < a; c += 1)
604
586
  for (let s = 0; s < i; s += 1) {
605
- const d = (c * i + s) * 4, E = r[d] ?? 0, _ = r[d + 1] ?? 0;
606
- if (E < -t.trough || Math.abs(_) > t.velocity)
587
+ const d = (c * i + s) * 4, E = r[d] ?? 0, p = r[d + 1] ?? 0;
588
+ if (E < -t.trough || Math.abs(p) > t.velocity)
607
589
  return !0;
608
590
  const m = s > 0 ? l(s - 1, c) : E, v = s < i - 1 ? l(s + 1, c) : E, A = c > 0 ? l(s, c - 1) : E, w = c < a - 1 ? l(s, c + 1) : E, W = Math.hypot(v - m, w - A), H = Math.abs(m + v + A + w - E * 4);
609
591
  if (W > t.gradient || H > t.curvature)
@@ -666,7 +648,7 @@ function ge(r) {
666
648
  )
667
649
  };
668
650
  }
669
- function Ue(r, e, n = r.timeStamp) {
651
+ function De(r, e, n = r.timeStamp) {
670
652
  const t = typeof r.getCoalescedEvents == "function" ? r.getCoalescedEvents() : [], i = t.length > 0 ? t : [r], a = n - r.timeStamp;
671
653
  return i.map((l) => ({
672
654
  x: l.clientX - e.left,
@@ -711,11 +693,11 @@ class ct {
711
693
  Math.max(1, Math.ceil(a / this.options.segmentSpacing))
712
694
  );
713
695
  for (let d = 0; d < s; d += 1) {
714
- const E = d / s, _ = (d + 1) / s;
696
+ const E = d / s, p = (d + 1) / s;
715
697
  this.disturbances.push(
716
698
  ve(
717
- De(t, i, E),
718
- De(t, i, _),
699
+ Ue(t, i, E),
700
+ Ue(t, i, p),
719
701
  this.smoothedVelocity,
720
702
  this.options
721
703
  )
@@ -759,7 +741,7 @@ function ve(r, e, n, t) {
759
741
  velocity: a
760
742
  };
761
743
  }
762
- function De(r, e, n) {
744
+ function Ue(r, e, n) {
763
745
  return {
764
746
  x: O(r.x, e.x, n),
765
747
  y: O(r.y, e.y, n),
@@ -946,19 +928,19 @@ const gt = $e(function(e, n) {
946
928
  className: l,
947
929
  style: c,
948
930
  reducedMotion: s = "respect"
949
- } = e, d = y(null), E = y(null), _ = y(null), m = y(new ct()), v = y(null), A = y(null), w = y(() => {
931
+ } = e, d = y(null), E = y(null), p = y(null), m = y(new ct()), v = y(null), A = y(null), w = y(() => {
950
932
  }), W = y(() => {
951
933
  }), H = y(() => {
952
- }), P = y([]), U = y(!0), k = y(!0), B = y(!1), M = y(!1), I = y(null), z = y(0), N = y(0), D = y(0), R = ft(e), g = y(R), $ = y({ width: 1, height: 1 }), Ne = mt(
934
+ }), P = y([]), D = y(!0), k = y(!0), B = y(!1), M = y(!1), I = y(null), z = y(0), N = y(0), U = y(0), R = ft(e), g = y(R), $ = y({ width: 1, height: 1 }), Ne = mt(
953
935
  s === "respect"
954
936
  ), ue = s === "disable" || s === "respect" && Ne, Xe = a ?? i;
955
937
  g.current = R, Qe(
956
938
  n,
957
939
  () => ({
958
- triggerRipple(S) {
940
+ triggerRipple(_) {
959
941
  B.current || M.current || H.current(
960
942
  Ce(
961
- S,
943
+ _,
962
944
  g.current,
963
945
  $.current
964
946
  )
@@ -967,19 +949,19 @@ const gt = $e(function(e, n) {
967
949
  }),
968
950
  []
969
951
  ), V(() => {
970
- var S;
971
- B.current = ue, ue && (m.current.reset(), I.current = null, P.current = [], z.current = 0, N.current = 0, D.current = 0, (S = _.current) == null || S.clear()), w.current();
952
+ var _;
953
+ B.current = ue, ue && (m.current.reset(), I.current = null, P.current = [], z.current = 0, N.current = 0, U.current = 0, (_ = p.current) == null || _.clear()), w.current();
972
954
  }, [ue]), V(() => {
973
- const S = _.current;
974
- if (!S)
955
+ const _ = p.current;
956
+ if (!_)
975
957
  return;
976
958
  const { width: K, height: b } = $.current;
977
- S.resize(
959
+ _.resize(
978
960
  K,
979
961
  b,
980
962
  window.devicePixelRatio,
981
963
  R.simulationResolution
982
- ), S.setTextureSource(R.texture), w.current();
964
+ ), _.setTextureSource(R.texture), w.current();
983
965
  }, [
984
966
  R.mode,
985
967
  R.texture,
@@ -992,8 +974,8 @@ const gt = $e(function(e, n) {
992
974
  R.causticIntensity,
993
975
  R.simulationResolution
994
976
  ]), V(() => {
995
- const S = d.current, K = E.current;
996
- if (!S || !K)
977
+ const _ = d.current, K = E.current;
978
+ if (!_ || !K)
997
979
  return;
998
980
  k.current = typeof document.hasFocus == "function" ? document.hasFocus() : !0;
999
981
  let b = null, ie, ee = G, xe = !1, te;
@@ -1022,7 +1004,7 @@ const gt = $e(function(e, n) {
1022
1004
  window.devicePixelRatio,
1023
1005
  g.current.simulationResolution
1024
1006
  );
1025
- }, pe = () => {
1007
+ }, Ee = () => {
1026
1008
  b == null || b.render(g.current, performance.now() * 1e-3);
1027
1009
  }, X = () => {
1028
1010
  ie = void 0, ee = G;
@@ -1031,19 +1013,19 @@ const gt = $e(function(e, n) {
1031
1013
  }, Q = () => {
1032
1014
  const o = g.current;
1033
1015
  let u = !1;
1034
- if (!(!B.current && !M.current && U.current && (o.runInBackground || !document.hidden && k.current))) {
1016
+ if (!(!B.current && !M.current && D.current && (o.runInBackground || !document.hidden && k.current))) {
1035
1017
  X();
1036
1018
  return;
1037
1019
  }
1038
1020
  if (te !== void 0) {
1039
1021
  const T = performance.now() - te;
1040
- z.current += T, N.current += T, D.current += T, te = void 0, u = !0;
1022
+ z.current += T, N.current += T, U.current += T, te = void 0, u = !0;
1041
1023
  }
1042
- (!o.runInBackground || u) && X(), pe(), w.current();
1043
- }, Ee = (o) => {
1024
+ (!o.runInBackground || u) && X(), Ee(), w.current();
1025
+ }, pe = (o) => {
1044
1026
  v.current = null;
1045
1027
  const u = g.current;
1046
- if (!b || M.current || !U.current || !u.runInBackground && (document.hidden || !k.current)) {
1028
+ if (!b || M.current || !D.current || !u.runInBackground && (document.hidden || !k.current)) {
1047
1029
  X();
1048
1030
  return;
1049
1031
  }
@@ -1075,27 +1057,27 @@ const gt = $e(function(e, n) {
1075
1057
  o < N.current ? w.current() : X();
1076
1058
  return;
1077
1059
  }
1078
- if (o < D.current) {
1060
+ if (o < U.current) {
1079
1061
  w.current();
1080
1062
  return;
1081
1063
  }
1082
1064
  try {
1083
- b.hasVisibleActivity() ? (D.current = o + ht, w.current()) : X();
1065
+ b.hasVisibleActivity() ? (U.current = o + ht, w.current()) : X();
1084
1066
  } catch {
1085
1067
  xe = !0, o < N.current ? w.current() : X();
1086
1068
  }
1087
1069
  }, le = () => {
1088
1070
  M.current || v.current !== null || A.current !== null || (g.current.runInBackground && document.hidden ? A.current = window.setTimeout(() => {
1089
- A.current = null, Ee(performance.now());
1090
- }, G) : v.current = window.requestAnimationFrame(Ee));
1071
+ A.current = null, pe(performance.now());
1072
+ }, G) : v.current = window.requestAnimationFrame(pe));
1091
1073
  };
1092
1074
  w.current = le;
1093
1075
  try {
1094
1076
  b = new rt(K, () => {
1095
1077
  w.current();
1096
- }), _.current = b, b.setTextureSource(g.current.texture);
1078
+ }), p.current = b, b.setTextureSource(g.current.texture);
1097
1079
  } catch {
1098
- return K.style.display = "none", _.current = null, w.current = () => {
1080
+ return K.style.display = "none", p.current = null, w.current = () => {
1099
1081
  }, () => {
1100
1082
  };
1101
1083
  }
@@ -1103,7 +1085,7 @@ const gt = $e(function(e, n) {
1103
1085
  const o = K.getBoundingClientRect();
1104
1086
  return He(o.width, o.height), o;
1105
1087
  }, ze = () => {
1106
- ae(), pe();
1088
+ ae(), Ee();
1107
1089
  }, he = (o) => {
1108
1090
  if (M.current || o.length === 0)
1109
1091
  return;
@@ -1115,15 +1097,15 @@ const gt = $e(function(e, n) {
1115
1097
  z.current = Math.max(z.current, T), N.current = Math.max(
1116
1098
  N.current,
1117
1099
  T + ut(g.current.damping)
1118
- ), D.current = 0, le();
1100
+ ), U.current = 0, le();
1119
1101
  };
1120
1102
  H.current = he;
1121
1103
  const _e = (o) => {
1122
1104
  const u = g.current;
1123
- if (B.current || M.current || !U.current || u.interactionMode === "event" || !u.runInBackground && (document.hidden || !k.current) || o.pointerType === "touch" && !o.isPrimary)
1105
+ if (B.current || M.current || !D.current || u.interactionMode === "event" || !u.runInBackground && (document.hidden || !k.current) || o.pointerType === "touch" && !o.isPrimary)
1124
1106
  return;
1125
1107
  m.current.reset();
1126
- const F = ae(), [T] = Ue(o, F, performance.now());
1108
+ const F = ae(), [T] = De(o, F, performance.now());
1127
1109
  T && ((u.interactionMode === "click" || u.interactionMode === "drag") && he(
1128
1110
  Ce(
1129
1111
  {
@@ -1136,9 +1118,9 @@ const gt = $e(function(e, n) {
1136
1118
  ), u.interactionMode === "drag" ? (I.current = o.pointerId, m.current.addSample(T)) : u.interactionMode === "move" && m.current.addSample(T));
1137
1119
  }, Se = (o) => {
1138
1120
  const u = g.current;
1139
- if (B.current || M.current || !U.current || u.interactionMode !== "move" && (u.interactionMode !== "drag" || I.current !== o.pointerId) || !u.runInBackground && (document.hidden || !k.current) || o.pointerType === "touch" && !o.isPrimary)
1121
+ if (B.current || M.current || !D.current || u.interactionMode !== "move" && (u.interactionMode !== "drag" || I.current !== o.pointerId) || !u.runInBackground && (document.hidden || !k.current) || o.pointerType === "touch" && !o.isPrimary)
1140
1122
  return;
1141
- const F = ae(), T = Ue(o, F, performance.now());
1123
+ const F = ae(), T = De(o, F, performance.now());
1142
1124
  for (const Z of T)
1143
1125
  he(m.current.addSample(Z));
1144
1126
  }, j = (o) => {
@@ -1163,20 +1145,20 @@ const gt = $e(function(e, n) {
1163
1145
  let ne;
1164
1146
  return "IntersectionObserver" in window && (ne = new IntersectionObserver((o) => {
1165
1147
  const u = o[0];
1166
- U.current = u ? u.isIntersecting : !0, U.current ? Q() : re();
1167
- }), ne.observe(S)), S.addEventListener("pointerdown", _e, {
1148
+ D.current = u ? u.isIntersecting : !0, D.current ? Q() : re();
1149
+ }), ne.observe(_)), _.addEventListener("pointerdown", _e, {
1168
1150
  passive: !0
1169
- }), S.addEventListener("pointermove", Se, {
1151
+ }), _.addEventListener("pointermove", Se, {
1170
1152
  passive: !0
1171
- }), S.addEventListener("pointerup", j, {
1153
+ }), _.addEventListener("pointerup", j, {
1172
1154
  passive: !0
1173
- }), S.addEventListener("pointerleave", j, {
1155
+ }), _.addEventListener("pointerleave", j, {
1174
1156
  passive: !0
1175
- }), S.addEventListener("pointercancel", j, {
1157
+ }), _.addEventListener("pointercancel", j, {
1176
1158
  passive: !0
1177
1159
  }), window.addEventListener("blur", Re), window.addEventListener("focus", we), document.addEventListener("keydown", Te), document.addEventListener("visibilitychange", ye), () => {
1178
1160
  var o;
1179
- Y(), Me.disconnect(), ne == null || ne.disconnect(), S.removeEventListener("pointerdown", _e), S.removeEventListener("pointermove", Se), S.removeEventListener("pointerup", j), S.removeEventListener("pointerleave", j), S.removeEventListener("pointercancel", j), window.removeEventListener("blur", Re), window.removeEventListener("focus", we), document.removeEventListener("keydown", Te), document.removeEventListener("visibilitychange", ye), (o = _.current) == null || o.dispose(), _.current = null, w.current = () => {
1161
+ Y(), Me.disconnect(), ne == null || ne.disconnect(), _.removeEventListener("pointerdown", _e), _.removeEventListener("pointermove", Se), _.removeEventListener("pointerup", j), _.removeEventListener("pointerleave", j), _.removeEventListener("pointercancel", j), window.removeEventListener("blur", Re), window.removeEventListener("focus", we), document.removeEventListener("keydown", Te), document.removeEventListener("visibilitychange", ye), (o = p.current) == null || o.dispose(), p.current = null, w.current = () => {
1180
1162
  }, W.current = () => {
1181
1163
  }, H.current = () => {
1182
1164
  };
@@ -1235,9 +1217,9 @@ const gt = $e(function(e, n) {
1235
1217
  }
1236
1218
  )
1237
1219
  ] });
1238
- }), Et = gt;
1220
+ }), pt = gt;
1239
1221
  export {
1240
1222
  gt as WaterDistortion,
1241
- Et as WaterLayer
1223
+ pt as WaterLayer
1242
1224
  };
1243
1225
  //# sourceMappingURL=water-distortion.js.map