@kolkrabbi/design-editor 0.23.0 → 0.26.0

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.
Files changed (34) hide show
  1. package/README.md +2 -2
  2. package/dist/BindDot-CMUtpJPX.js +84 -0
  3. package/dist/BufferGeometryUtils-Cc8LNd5v.js +150 -0
  4. package/dist/ColorModesWindow-CWhL6nfm.js +1493 -0
  5. package/dist/GLTFLoader-BFir8PCc.js +1361 -0
  6. package/dist/OBJLoader-BgqC_-Jn.js +287 -0
  7. package/dist/{OrbitControls-Cql8Rn2i.js → OrbitControls-DVpLgmKv.js} +2755 -2202
  8. package/dist/STLLoader-C6DGLf6r.js +83 -0
  9. package/dist/TreePicker-nMf17QGH.js +68 -0
  10. package/dist/core-CfGqY4VB.js +17504 -0
  11. package/dist/core.js +4 -3
  12. package/dist/design-editor.css +1 -1
  13. package/dist/design-editor.js +2114 -916
  14. package/dist/effects-DZEmfY7a.js +444 -0
  15. package/dist/effects.js +1 -1
  16. package/dist/generators-D1tFSZgG.js +2961 -0
  17. package/dist/generators.js +1 -1
  18. package/dist/{host-B4SRaN9h.js → host-CRsCCafL.js} +429 -370
  19. package/dist/{host-be1CWhN1.js → host-ZLJKCZ54.js} +137 -136
  20. package/dist/motion-BJ8xqUKI.js +3096 -0
  21. package/dist/motion.js +1 -1
  22. package/dist/previewScale-BMkeLc6w.js +26 -0
  23. package/dist/{rolls-Bg1XHuvJ.js → rolls-BGtqxVYq.js} +2621 -1522
  24. package/dist/{src-B5fQgAVE.js → src-BpTckTDZ.js} +1 -1
  25. package/dist/{labels-B5qkocWy.js → timelinePinned-BwYq1Msi.js} +321 -164
  26. package/dist/{useLayerEdit-ieOjHx6x.js → useLayerEdit-BFcZhiNX.js} +20992 -12580
  27. package/package.json +11 -9
  28. package/dist/RuleRow-BXkjpTyN.js +0 -650
  29. package/dist/TreePicker-DLmMl0aU.js +0 -68
  30. package/dist/core-CTI1YRJD.js +0 -12335
  31. package/dist/effectCategories-BcaQSD_V.js +0 -4216
  32. package/dist/effects-pCd8YTdQ.js +0 -469
  33. package/dist/generators-B8_StNAy.js +0 -2517
  34. package/dist/motion-DFnAar_2.js +0 -2263
@@ -1,8 +1,9 @@
1
- import { G as e, M as t, N as n, U as r, W as i, X as a, Y as o, a as s, at as c, ct as l, d as u, f as d, g as f, h as p, j as m, ot as h, p as g, st as _, t as v, u as y } from "./OrbitControls-Cql8Rn2i.js";
1
+ import { n as e } from "./previewScale-BMkeLc6w.js";
2
+ import { Dt as t, Et as n, G as r, Gt as i, Ht as a, Ut as o, Vt as s, W as c, _ as l, _t as u, a as d, et as f, f as p, gt as m, h, ht as g, m as _, p as v, t as y, v as b } from "./OrbitControls-DVpLgmKv.js";
2
3
  //#region src/filters/gl/synthBase.js
3
- var b = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position.xy, 0.0, 1.0);\n }\n", x = class {
4
+ var x = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position.xy, 0.0, 1.0);\n }\n", S = class {
4
5
  constructor(e, { autoLoop: t = !1 } = {}) {
5
- this.canvas = e, this.autoLoop = t, this.renderer = new s({
6
+ this.canvas = e, this.autoLoop = t, this.renderer = new d({
6
7
  canvas: e,
7
8
  antialias: !0,
8
9
  preserveDrawingBuffer: !0,
@@ -11,8 +12,8 @@ var b = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
11
12
  }
12
13
  setSource(e) {
13
14
  this.tex && this.tex.dispose();
14
- let n = new g(e);
15
- n.minFilter = t, n.magFilter = t, n.wrapS = p, n.wrapT = p, this.tex = n, this.imageAspect = (e.width || 1) / (e.height || 1), this._onImage?.();
15
+ let t = new h(e);
16
+ t.minFilter = r, t.magFilter = r, t.wrapS = l, t.wrapT = l, this.tex = t, this.imageAspect = (e.width || 1) / (e.height || 1), this._onImage?.();
16
17
  }
17
18
  touchSource() {
18
19
  this.tex && (this.tex.needsUpdate = !0);
@@ -26,10 +27,10 @@ var b = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
26
27
  reset() {
27
28
  this.time = 0, this._reset?.();
28
29
  }
29
- resize(e, t) {
30
- if (e < 1 || t < 1) return;
31
- let n = Math.min(window.devicePixelRatio || 1, 2);
32
- this.renderer.setPixelRatio(n), this.renderer.setSize(e, t, !1), this.w = e, this.h = t, this._resize?.(e, t);
30
+ resize(t, n) {
31
+ if (t < 1 || n < 1) return;
32
+ let r = e();
33
+ this.renderer.setPixelRatio(r), this.renderer.setSize(t, n, !1), this.w = t, this.h = n, this._resize?.(t, n);
33
34
  }
34
35
  coverFit() {
35
36
  let e = this.w / this.h, t, n;
@@ -75,21 +76,21 @@ var b = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
75
76
  dispose() {
76
77
  this._raf && cancelAnimationFrame(this._raf), this._raf = null, this._dispose?.(), this.tex && this.tex.dispose(), this.renderer.dispose();
77
78
  }
78
- }, S = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uPrev;\n uniform sampler2D uImage;\n uniform vec2 uScale;\n uniform vec2 uOffset;\n uniform float uDecay;\n uniform float uTaps; // active heads (1..4)\n uniform float uZoom; // per-step feedback zoom\n uniform float uRot; // per-step rotation, rad\n uniform float uDrift; // per-step radial offset (chromatic convergence)\n uniform float uChroma; // per-head colour amount (0 = mono, 1 = full tint)\n uniform float uMix; // live source contribution (0 = pure feedback)\n uniform vec4 uGap; // per-head spacing multipliers (even/triplet/shift)\n uniform vec2 uOrigin; // feedback transform centre (the tunnel vanishing point)\n\n vec3 head(float g, vec3 tint, float on) {\n vec2 c = vUv - uOrigin;\n float a = uRot * g;\n float s = sin(a), co = cos(a);\n c = mat2(co, -s, s, co) * c;\n c *= pow(uZoom, g);\n c += normalize(c + 1e-4) * (uDrift * g);\n vec3 col = texture2D(uPrev, c + uOrigin).rgb;\n return mix(col, col * tint, uChroma) * on;\n }\n\n void main() {\n vec3 fbk = vec3(0.0);\n fbk += head(uGap.x, vec3(1.0, 0.25, 0.20), step(0.5, uTaps));\n fbk += head(uGap.y, vec3(0.30, 1.0, 0.35), step(1.5, uTaps));\n fbk += head(uGap.z, vec3(0.35, 0.50, 1.0), step(2.5, uTaps));\n fbk += head(uGap.w, vec3(1.0, 0.72, 0.25), step(3.5, uTaps));\n fbk = fbk / max(1.0, uTaps) * uDecay;\n vec3 src = texture2D(uImage, vUv * uScale + uOffset).rgb;\n gl_FragColor = vec4(clamp(max(fbk, src * uMix), 0.0, 1.0), 1.0);\n }\n", C = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uTex;\n uniform float uTime;\n uniform float uSat; // saturation boost (1 = none)\n uniform float uLock; // 70s palette colorize mix (0 = off)\n uniform float uHue; // hue cycle speed (0 = off)\n uniform float uGain; // output brightness (1 = none)\n vec3 satBoost(vec3 c, float s) { float l = dot(c, vec3(0.299, 0.587, 0.114)); return clamp(mix(vec3(l), c, s), 0.0, 1.0); }\n mat3 hueRot(float a) {\n float c = cos(a), s = sin(a);\n mat3 w = mat3(0.299, 0.299, 0.299, 0.587, 0.587, 0.587, 0.114, 0.114, 0.114);\n mat3 u = mat3(0.701, -0.299, -0.300, -0.587, 0.413, -0.588, -0.114, -0.114, 0.886);\n mat3 v = mat3(0.168, -0.328, 1.250, 0.330, 0.035, -1.050, -0.497, 0.292, -0.203);\n return w + u * c + v * s;\n }\n // Map luma → a vintage 70s ramp: rust · ochre · cream · teal · blue.\n vec3 pal70(float t) {\n t = clamp(t, 0.0, 1.0) * 4.0;\n vec3 a = vec3(0.75, 0.22, 0.17), b = vec3(0.88, 0.54, 0.12), c = vec3(0.95, 0.91, 0.84), d = vec3(0.16, 0.62, 0.56), e = vec3(0.17, 0.37, 0.54);\n if (t < 1.0) return mix(a, b, t);\n if (t < 2.0) return mix(b, c, t - 1.0);\n if (t < 3.0) return mix(c, d, t - 2.0);\n return mix(d, e, t - 3.0);\n }\n void main() {\n vec3 col = texture2D(uTex, vUv).rgb;\n if (uHue > 0.001) col = clamp(hueRot(uTime * uHue) * col, 0.0, 1.0);\n col = satBoost(col, uSat);\n col = mix(col, pal70(dot(col, vec3(0.299, 0.587, 0.114))), uLock);\n col = clamp(col * uGain, 0.0, 1.0);\n gl_FragColor = vec4(col, 1.0);\n }\n", w = {
79
- minFilter: t,
80
- magFilter: t,
79
+ }, C = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uPrev;\n uniform sampler2D uImage;\n uniform vec2 uScale;\n uniform vec2 uOffset;\n uniform float uDecay;\n uniform float uTaps; // active heads (1..4)\n uniform float uZoom; // per-step feedback zoom\n uniform float uRot; // per-step rotation, rad\n uniform float uDrift; // per-step radial offset (chromatic convergence)\n uniform float uChroma; // per-head colour amount (0 = mono, 1 = full tint)\n uniform float uMix; // live source contribution (0 = pure feedback)\n uniform vec4 uGap; // per-head spacing multipliers (even/triplet/shift)\n uniform vec2 uOrigin; // feedback transform centre (the tunnel vanishing point)\n\n vec3 head(float g, vec3 tint, float on) {\n vec2 c = vUv - uOrigin;\n float a = uRot * g;\n float s = sin(a), co = cos(a);\n c = mat2(co, -s, s, co) * c;\n c *= pow(uZoom, g);\n c += normalize(c + 1e-4) * (uDrift * g);\n vec3 col = texture2D(uPrev, c + uOrigin).rgb;\n return mix(col, col * tint, uChroma) * on;\n }\n\n void main() {\n vec3 fbk = vec3(0.0);\n fbk += head(uGap.x, vec3(1.0, 0.25, 0.20), step(0.5, uTaps));\n fbk += head(uGap.y, vec3(0.30, 1.0, 0.35), step(1.5, uTaps));\n fbk += head(uGap.z, vec3(0.35, 0.50, 1.0), step(2.5, uTaps));\n fbk += head(uGap.w, vec3(1.0, 0.72, 0.25), step(3.5, uTaps));\n fbk = fbk / max(1.0, uTaps) * uDecay;\n vec3 src = texture2D(uImage, vUv * uScale + uOffset).rgb;\n gl_FragColor = vec4(clamp(max(fbk, src * uMix), 0.0, 1.0), 1.0);\n }\n", w = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uTex;\n uniform float uTime;\n uniform float uSat; // saturation boost (1 = none)\n uniform float uLock; // 70s palette colorize mix (0 = off)\n uniform float uHue; // hue cycle speed (0 = off)\n uniform float uGain; // output brightness (1 = none)\n vec3 satBoost(vec3 c, float s) { float l = dot(c, vec3(0.299, 0.587, 0.114)); return clamp(mix(vec3(l), c, s), 0.0, 1.0); }\n mat3 hueRot(float a) {\n float c = cos(a), s = sin(a);\n mat3 w = mat3(0.299, 0.299, 0.299, 0.587, 0.587, 0.587, 0.114, 0.114, 0.114);\n mat3 u = mat3(0.701, -0.299, -0.300, -0.587, 0.413, -0.588, -0.114, -0.114, 0.886);\n mat3 v = mat3(0.168, -0.328, 1.250, 0.330, 0.035, -1.050, -0.497, 0.292, -0.203);\n return w + u * c + v * s;\n }\n // Map luma → a vintage 70s ramp: rust · ochre · cream · teal · blue.\n vec3 pal70(float t) {\n t = clamp(t, 0.0, 1.0) * 4.0;\n vec3 a = vec3(0.75, 0.22, 0.17), b = vec3(0.88, 0.54, 0.12), c = vec3(0.95, 0.91, 0.84), d = vec3(0.16, 0.62, 0.56), e = vec3(0.17, 0.37, 0.54);\n if (t < 1.0) return mix(a, b, t);\n if (t < 2.0) return mix(b, c, t - 1.0);\n if (t < 3.0) return mix(c, d, t - 2.0);\n return mix(d, e, t - 3.0);\n }\n void main() {\n vec3 col = texture2D(uTex, vUv).rgb;\n if (uHue > 0.001) col = clamp(hueRot(uTime * uHue) * col, 0.0, 1.0);\n col = satBoost(col, uSat);\n col = mix(col, pal70(dot(col, vec3(0.299, 0.587, 0.114))), uLock);\n col = clamp(col * uGain, 0.0, 1.0);\n gl_FragColor = vec4(col, 1.0);\n }\n", T = {
80
+ minFilter: r,
81
+ magFilter: r,
81
82
  depthBuffer: !1,
82
83
  stencilBuffer: !1
83
- }, T = class extends x {
84
+ }, E = class extends S {
84
85
  _setup() {
85
- this.camera = new r(-1, 1, 1, -1, 0, 1), this.scene = new o(), this.geo = new e(2, 2), this.rtA = new l(2, 2, w), this.rtB = new l(2, 2, w), this.fbMat = new a({
86
- vertexShader: b,
87
- fragmentShader: S,
86
+ this.camera = new g(-1, 1, 1, -1, 0, 1), this.scene = new n(), this.geo = new u(2, 2), this.rtA = new i(2, 2, T), this.rtB = new i(2, 2, T), this.fbMat = new t({
87
+ vertexShader: x,
88
+ fragmentShader: C,
88
89
  uniforms: {
89
90
  uPrev: { value: null },
90
91
  uImage: { value: null },
91
- uScale: { value: new c(1, 1) },
92
- uOffset: { value: new c(0, 0) },
92
+ uScale: { value: new s(1, 1) },
93
+ uOffset: { value: new s(0, 0) },
93
94
  uDecay: { value: .92 },
94
95
  uTaps: { value: 3 },
95
96
  uZoom: { value: 1 },
@@ -97,12 +98,12 @@ var b = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
97
98
  uDrift: { value: .02 },
98
99
  uChroma: { value: .6 },
99
100
  uMix: { value: 1 },
100
- uGap: { value: new _(1, 2, 3, 4) },
101
- uOrigin: { value: new c(.5, .5) }
101
+ uGap: { value: new o(1, 2, 3, 4) },
102
+ uOrigin: { value: new s(.5, .5) }
102
103
  }
103
- }), this.copyMat = new a({
104
- vertexShader: b,
105
- fragmentShader: C,
104
+ }), this.copyMat = new t({
105
+ vertexShader: x,
106
+ fragmentShader: w,
106
107
  uniforms: {
107
108
  uTex: { value: null },
108
109
  uTime: { value: 0 },
@@ -111,7 +112,7 @@ var b = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
111
112
  uHue: { value: 0 },
112
113
  uGain: { value: 1 }
113
114
  }
114
- }), this.quad = new n(this.geo, this.fbMat), this.scene.add(this.quad);
115
+ }), this.quad = new f(this.geo, this.fbMat), this.scene.add(this.quad);
115
116
  }
116
117
  _applyFit() {
117
118
  let { sx: e, sy: t, ox: n, oy: r } = this.coverFit();
@@ -166,7 +167,7 @@ var b = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position
166
167
  };
167
168
  //#endregion
168
169
  //#region src/filters/gl/orbit.js
169
- function E(e, t, n, r = [
170
+ function D(e, t, n, r = [
170
171
  0,
171
172
  0,
172
173
  0
@@ -180,22 +181,22 @@ function E(e, t, n, r = [
180
181
  }
181
182
  //#endregion
182
183
  //#region src/filters/gl/scanEngine.js
183
- var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying vec3 vColor;\n varying float vLuma;\n void main() {\n vec3 c = texture2D(uImage, uv).rgb;\n float luma = dot(c, vec3(0.299, 0.587, 0.114));\n vColor = c;\n vLuma = luma;\n vec3 p = position;\n p.z += (luma - 0.5) * uDisplace;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(p, 1.0);\n }\n", O = "\n precision highp float;\n varying vec3 vColor;\n varying float vLuma;\n uniform float uMono;\n uniform float uOpacity;\n uniform vec3 uTint;\n void main() {\n vec3 col = mix(vColor, uTint * (0.25 + vLuma), uMono);\n gl_FragColor = vec4(col, uOpacity);\n }\n", k = Math.PI * 2, A = class extends x {
184
+ var O = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying vec3 vColor;\n varying float vLuma;\n void main() {\n vec3 c = texture2D(uImage, uv).rgb;\n float luma = dot(c, vec3(0.299, 0.587, 0.114));\n vColor = c;\n vLuma = luma;\n vec3 p = position;\n p.z += (luma - 0.5) * uDisplace;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(p, 1.0);\n }\n", k = "\n precision highp float;\n varying vec3 vColor;\n varying float vLuma;\n uniform float uMono;\n uniform float uOpacity;\n uniform vec3 uTint;\n void main() {\n vec3 col = mix(vColor, uTint * (0.25 + vLuma), uMono);\n gl_FragColor = vec4(col, uOpacity);\n }\n", A = Math.PI * 2, j = class extends S {
184
185
  _setup() {
185
- this.scene = new o(), this.camera = new i(45, 1, .1, 100);
186
- let [e, t, n] = E(0, .4, 3);
187
- this.camera.position.set(e, t, n), this.controls = new v(this.camera, this.canvas), this.controls.enableDamping = !0, this.controls.dampingFactor = .08, this.controls.enablePan = !1, this.controls.minDistance = 1.5, this.controls.maxDistance = 8, this.controls.target.set(0, 0, 0), this.controls.update(), this.mat = new a({
188
- vertexShader: D,
189
- fragmentShader: O,
186
+ this.scene = new n(), this.camera = new m(45, 1, .1, 100);
187
+ let [e, r, i] = D(0, .4, 3);
188
+ this.camera.position.set(e, r, i), this.controls = new y(this.camera, this.canvas), this.controls.enableDamping = !0, this.controls.dampingFactor = .08, this.controls.enablePan = !1, this.controls.minDistance = 1.5, this.controls.maxDistance = 8, this.controls.target.set(0, 0, 0), this.controls.update(), this.mat = new t({
189
+ vertexShader: O,
190
+ fragmentShader: k,
190
191
  transparent: !0,
191
192
  uniforms: {
192
193
  uImage: { value: null },
193
194
  uDisplace: { value: 1 },
194
195
  uMono: { value: 0 },
195
196
  uOpacity: { value: 1 },
196
- uTint: { value: new f("#9fe7ff") }
197
+ uTint: { value: new b("#9fe7ff") }
197
198
  }
198
- }), this.mesh = null, this.rows = 140, this.cols = 220, this._camKey = "", this._bg = new f("#0b0e13"), this._buildMesh();
199
+ }), this.mesh = null, this.rows = 140, this.cols = 220, this._camKey = "", this._bg = new b("#0b0e13"), this._buildMesh();
199
200
  }
200
201
  _buildMesh() {
201
202
  let e = Math.max(8, Math.round(this.cols)), t = Math.max(8, Math.round(this.rows)), n = this.imageAspect || 1, r = new Float32Array(e * t * 3), i = new Float32Array(e * t * 2);
@@ -205,8 +206,8 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
205
206
  }
206
207
  let a = [];
207
208
  for (let n = 0; n < t; n++) for (let t = 0; t < e - 1; t++) a.push(n * e + t, n * e + t + 1);
208
- let o = new u();
209
- o.setAttribute("position", new y(r, 3)), o.setAttribute("uv", new y(i, 2)), o.setIndex(a), this.mesh && (this.scene.remove(this.mesh), this.mesh.geometry.dispose()), this.mesh = new m(o, this.mat), this.scene.add(this.mesh);
209
+ let o = new v();
210
+ o.setAttribute("position", new p(r, 3)), o.setAttribute("uv", new p(i, 2)), o.setIndex(a), this.mesh && (this.scene.remove(this.mesh), this.mesh.geometry.dispose()), this.mesh = new c(o, this.mat), this.scene.add(this.mesh);
210
211
  }
211
212
  _onImage() {
212
213
  this.mat.uniforms.uImage.value = this.tex, this._buildMesh();
@@ -221,7 +222,7 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
221
222
  let t = `${e.yaw}|${e.pitch}|${e.dist}`;
222
223
  if (t !== this._camKey) {
223
224
  this._camKey = t;
224
- let [n, r, i] = E(e.yaw ?? 0, e.pitch ?? .4, e.dist ?? 3);
225
+ let [n, r, i] = D(e.yaw ?? 0, e.pitch ?? .4, e.dist ?? 3);
225
226
  this.camera.position.set(n, r, i), this.controls.target.set(0, 0, 0), this.controls.update();
226
227
  }
227
228
  }
@@ -232,7 +233,7 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
232
233
  resolveCam() {
233
234
  let e = this.params, t = e.yaw ?? 0, n = e.pitch ?? .4, r = e.dist ?? 3;
234
235
  if (e.cameraMotion) {
235
- let i = this.time * (e.motionSpeed ?? .3), a = Math.sin(i * k);
236
+ let i = this.time * (e.motionSpeed ?? .3), a = Math.sin(i * A);
236
237
  switch (e.motionPreset) {
237
238
  case "spin":
238
239
  t = i * 2.2;
@@ -267,7 +268,7 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
267
268
  }
268
269
  if (this.params.cameraMotion) {
269
270
  this.controls.enabled = !1;
270
- let { yaw: e, pitch: t, dist: n } = this.resolveCam(), [r, i, a] = E(e, t, n);
271
+ let { yaw: e, pitch: t, dist: n } = this.resolveCam(), [r, i, a] = D(e, t, n);
271
272
  this.camera.position.set(r, i, a), this.camera.lookAt(0, 0, 0);
272
273
  } else this.controls.enabled = !0, this.controls.update();
273
274
  this.renderer.render(this.scene, this.camera);
@@ -275,37 +276,37 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
275
276
  _dispose() {
276
277
  this.controls.dispose(), this.mesh && this.mesh.geometry.dispose(), this.mat.dispose();
277
278
  }
278
- }, j = 160, M = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uImage;\n uniform vec2 uScale, uOffset;\n void main() { gl_FragColor = texture2D(uImage, vUv * uScale + uOffset); }\n", N = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uImage;\n uniform vec2 uScale, uOffset;\n uniform float uSlit;\n uniform int uAxis;\n void main() {\n float cross = (uAxis == 0) ? vUv.y : vUv.x;\n vec2 suv = (uAxis == 0) ? vec2(uSlit, cross) : vec2(cross, uSlit);\n gl_FragColor = texture2D(uImage, suv * uScale + uOffset);\n }\n", P = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uStrip, uImage;\n uniform vec2 uScale, uOffset;\n uniform float uHead, uDir, uOrig, uSmooth;\n uniform int uAxis, uMode; // uMode 0 = chop, 1 = finish\n vec2 sUV(float pos, float cross) { return (uAxis == 0) ? vec2(pos, cross) : vec2(cross, pos); }\n float toPos(float along) {\n if (uMode == 1) { float t = (uDir > 0.0) ? along : 1.0 - along; return fract(uHead - t); }\n return (uDir > 0.0) ? along : 1.0 - along;\n }\n void main() {\n float along = (uAxis == 0) ? vUv.x : vUv.y;\n float cross = (uAxis == 0) ? vUv.y : vUv.x;\n float r = uSmooth * 0.03;\n vec4 e = texture2D(uStrip, sUV(toPos(along), cross)) * 0.383\n + (texture2D(uStrip, sUV(toPos(along + r), cross)) + texture2D(uStrip, sUV(toPos(along - r), cross))) * 0.242\n + (texture2D(uStrip, sUV(toPos(along + 2.0 * r), cross)) + texture2D(uStrip, sUV(toPos(along - 2.0 * r), cross))) * 0.0665;\n vec4 s = texture2D(uImage, vUv * uScale + uOffset);\n gl_FragColor = mix(e, s, uOrig);\n }\n", F = {
279
- minFilter: t,
280
- magFilter: t,
279
+ }, M = 160, N = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uImage;\n uniform vec2 uScale, uOffset;\n void main() { gl_FragColor = texture2D(uImage, vUv * uScale + uOffset); }\n", P = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uImage;\n uniform vec2 uScale, uOffset;\n uniform float uSlit;\n uniform int uAxis;\n void main() {\n float cross = (uAxis == 0) ? vUv.y : vUv.x;\n vec2 suv = (uAxis == 0) ? vec2(uSlit, cross) : vec2(cross, uSlit);\n gl_FragColor = texture2D(uImage, suv * uScale + uOffset);\n }\n", F = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uStrip, uImage;\n uniform vec2 uScale, uOffset;\n uniform float uHead, uDir, uOrig, uSmooth;\n uniform int uAxis, uMode; // uMode 0 = chop, 1 = finish\n vec2 sUV(float pos, float cross) { return (uAxis == 0) ? vec2(pos, cross) : vec2(cross, pos); }\n float toPos(float along) {\n if (uMode == 1) { float t = (uDir > 0.0) ? along : 1.0 - along; return fract(uHead - t); }\n return (uDir > 0.0) ? along : 1.0 - along;\n }\n void main() {\n float along = (uAxis == 0) ? vUv.x : vUv.y;\n float cross = (uAxis == 0) ? vUv.y : vUv.x;\n float r = uSmooth * 0.03;\n vec4 e = texture2D(uStrip, sUV(toPos(along), cross)) * 0.383\n + (texture2D(uStrip, sUV(toPos(along + r), cross)) + texture2D(uStrip, sUV(toPos(along - r), cross))) * 0.242\n + (texture2D(uStrip, sUV(toPos(along + 2.0 * r), cross)) + texture2D(uStrip, sUV(toPos(along - 2.0 * r), cross))) * 0.0665;\n vec4 s = texture2D(uImage, vUv * uScale + uOffset);\n gl_FragColor = mix(e, s, uOrig);\n }\n", I = {
280
+ minFilter: r,
281
+ magFilter: r,
281
282
  depthBuffer: !1,
282
283
  stencilBuffer: !1
283
- }, I = class extends x {
284
+ }, L = class extends S {
284
285
  _setup() {
285
- this.camera = new r(-1, 1, 1, -1, 0, 1), this.scene = new o(), this.geo = new e(2, 2), this.quad = new n(this.geo, null), this.scene.add(this.quad), this.scrollMul = 1, this._acc = 0, this.headPx = 0, this.strip = null;
286
- let t = () => ({
286
+ this.camera = new g(-1, 1, 1, -1, 0, 1), this.scene = new n(), this.geo = new u(2, 2), this.quad = new f(this.geo, null), this.scene.add(this.quad), this.scrollMul = 1, this._acc = 0, this.headPx = 0, this.strip = null;
287
+ let e = () => ({
287
288
  uImage: { value: null },
288
- uScale: { value: new c(1, 1) },
289
- uOffset: { value: new c(0, 0) }
289
+ uScale: { value: new s(1, 1) },
290
+ uOffset: { value: new s(0, 0) }
290
291
  });
291
- this.srcMat = new a({
292
- vertexShader: b,
293
- fragmentShader: M,
294
- uniforms: t()
295
- }), this.slitMat = new a({
296
- vertexShader: b,
292
+ this.srcMat = new t({
293
+ vertexShader: x,
297
294
  fragmentShader: N,
295
+ uniforms: e()
296
+ }), this.slitMat = new t({
297
+ vertexShader: x,
298
+ fragmentShader: P,
298
299
  uniforms: {
299
- ...t(),
300
+ ...e(),
300
301
  uSlit: { value: .5 },
301
302
  uAxis: { value: 0 }
302
303
  }
303
- }), this.dispMat = new a({
304
- vertexShader: b,
305
- fragmentShader: P,
304
+ }), this.dispMat = new t({
305
+ vertexShader: x,
306
+ fragmentShader: F,
306
307
  uniforms: {
307
308
  uStrip: { value: null },
308
- ...t(),
309
+ ...e(),
309
310
  uHead: { value: 0 },
310
311
  uDir: { value: 1 },
311
312
  uOrig: { value: 0 },
@@ -316,7 +317,7 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
316
317
  });
317
318
  }
318
319
  _makeRT(e, t) {
319
- return new l(Math.max(2, e), Math.max(2, t), F);
320
+ return new i(Math.max(2, e), Math.max(2, t), I);
320
321
  }
321
322
  _clearRT(e) {
322
323
  this.renderer.setRenderTarget(e), this.renderer.setClearColor(0, 0), this.renderer.clear(), this.renderer.setRenderTarget(null);
@@ -349,7 +350,7 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
349
350
  }
350
351
  _advance(e) {
351
352
  let t = this.params.speed ?? 1;
352
- this.paused || (this._acc += e * t * this.scrollMul * j);
353
+ this.paused || (this._acc += e * t * this.scrollMul * M);
353
354
  let n = Math.floor(this._acc);
354
355
  return n > 0 && (this._acc -= n), Math.min(n, Math.floor(Math.max(this.w, this.h) / 2));
355
356
  }
@@ -380,26 +381,26 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
380
381
  ]) e.dispose();
381
382
  this.geo.dispose();
382
383
  }
383
- }, L = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uImage;\n uniform vec2 uScale, uOffset;\n uniform float uTime;\n uniform vec2 uOrigin, uZoomV, uPan, uDrift;\n uniform float uRot, uSpin, uTwist, uSeg;\n uniform int uMirror; // 0 none · 1 kaleido · 2 mirror X · 3 mirror Y · 4 quad\n uniform float uPulse, uPulseRate;\n uniform float uHue, uPost, uStrobe, uSat, uLock;\n\n mat2 rot(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }\n vec3 satBoost(vec3 c, float s) { float l = dot(c, vec3(0.299, 0.587, 0.114)); return clamp(mix(vec3(l), c, s), 0.0, 1.0); }\n vec3 pal70(float t) {\n t = clamp(t, 0.0, 1.0) * 4.0;\n vec3 a = vec3(0.75, 0.22, 0.17), b = vec3(0.88, 0.54, 0.12), c = vec3(0.95, 0.91, 0.84), d = vec3(0.16, 0.62, 0.56), e = vec3(0.17, 0.37, 0.54);\n if (t < 1.0) return mix(a, b, t);\n if (t < 2.0) return mix(b, c, t - 1.0);\n if (t < 3.0) return mix(c, d, t - 2.0);\n return mix(d, e, t - 3.0);\n }\n mat3 hueRot(float a) {\n float c = cos(a), s = sin(a);\n mat3 w = mat3(0.299, 0.299, 0.299, 0.587, 0.587, 0.587, 0.114, 0.114, 0.114);\n mat3 u = mat3(0.701, -0.299, -0.300, -0.587, 0.413, -0.588, -0.114, -0.114, 0.886);\n mat3 v = mat3(0.168, -0.328, 1.250, 0.330, 0.035, -1.050, -0.497, 0.292, -0.203);\n return w + u * c + v * s;\n }\n\n void main() {\n vec2 uv = vUv - uOrigin;\n float pulse = 1.0 + uPulse * sin(uTime * uPulseRate * 6.2831853);\n uv /= max(vec2(0.05), uZoomV * pulse);\n uv = rot(uRot + uTime * uSpin) * uv;\n uv = rot(uTwist * length(uv)) * uv;\n if (uMirror == 1) {\n float ang = atan(uv.y, uv.x);\n float rad = length(uv);\n float seg = 6.2831853 / max(1.0, uSeg);\n ang = abs(mod(ang, seg) - seg * 0.5);\n uv = vec2(cos(ang), sin(ang)) * rad;\n } else if (uMirror == 2) { uv.x = abs(uv.x); }\n else if (uMirror == 3) { uv.y = abs(uv.y); }\n else if (uMirror == 4) { uv = abs(uv); }\n uv += uOrigin + uPan + uTime * uDrift;\n vec3 col = texture2D(uImage, fract(uv) * uScale + uOffset).rgb;\n col = clamp(hueRot(uTime * uHue) * col, 0.0, 1.0);\n col = satBoost(col, uSat);\n col = mix(col, pal70(dot(col, vec3(0.299, 0.587, 0.114))), uLock);\n if (uPost > 1.5) col = floor(col * uPost) / uPost;\n if (uStrobe > 0.01) { float f = step(0.5, fract(uTime * uStrobe)); col *= mix(1.0, f, 0.7); }\n gl_FragColor = vec4(col, 1.0);\n }\n", R = {
384
+ }, R = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uImage;\n uniform vec2 uScale, uOffset;\n uniform float uTime;\n uniform vec2 uOrigin, uZoomV, uPan, uDrift;\n uniform float uRot, uSpin, uTwist, uSeg;\n uniform int uMirror; // 0 none · 1 kaleido · 2 mirror X · 3 mirror Y · 4 quad\n uniform float uPulse, uPulseRate;\n uniform float uHue, uPost, uStrobe, uSat, uLock;\n\n mat2 rot(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }\n vec3 satBoost(vec3 c, float s) { float l = dot(c, vec3(0.299, 0.587, 0.114)); return clamp(mix(vec3(l), c, s), 0.0, 1.0); }\n vec3 pal70(float t) {\n t = clamp(t, 0.0, 1.0) * 4.0;\n vec3 a = vec3(0.75, 0.22, 0.17), b = vec3(0.88, 0.54, 0.12), c = vec3(0.95, 0.91, 0.84), d = vec3(0.16, 0.62, 0.56), e = vec3(0.17, 0.37, 0.54);\n if (t < 1.0) return mix(a, b, t);\n if (t < 2.0) return mix(b, c, t - 1.0);\n if (t < 3.0) return mix(c, d, t - 2.0);\n return mix(d, e, t - 3.0);\n }\n mat3 hueRot(float a) {\n float c = cos(a), s = sin(a);\n mat3 w = mat3(0.299, 0.299, 0.299, 0.587, 0.587, 0.587, 0.114, 0.114, 0.114);\n mat3 u = mat3(0.701, -0.299, -0.300, -0.587, 0.413, -0.588, -0.114, -0.114, 0.886);\n mat3 v = mat3(0.168, -0.328, 1.250, 0.330, 0.035, -1.050, -0.497, 0.292, -0.203);\n return w + u * c + v * s;\n }\n\n void main() {\n vec2 uv = vUv - uOrigin;\n float pulse = 1.0 + uPulse * sin(uTime * uPulseRate * 6.2831853);\n uv /= max(vec2(0.05), uZoomV * pulse);\n uv = rot(uRot + uTime * uSpin) * uv;\n uv = rot(uTwist * length(uv)) * uv;\n if (uMirror == 1) {\n float ang = atan(uv.y, uv.x);\n float rad = length(uv);\n float seg = 6.2831853 / max(1.0, uSeg);\n ang = abs(mod(ang, seg) - seg * 0.5);\n uv = vec2(cos(ang), sin(ang)) * rad;\n } else if (uMirror == 2) { uv.x = abs(uv.x); }\n else if (uMirror == 3) { uv.y = abs(uv.y); }\n else if (uMirror == 4) { uv = abs(uv); }\n uv += uOrigin + uPan + uTime * uDrift;\n vec3 col = texture2D(uImage, fract(uv) * uScale + uOffset).rgb;\n col = clamp(hueRot(uTime * uHue) * col, 0.0, 1.0);\n col = satBoost(col, uSat);\n col = mix(col, pal70(dot(col, vec3(0.299, 0.587, 0.114))), uLock);\n if (uPost > 1.5) col = floor(col * uPost) / uPost;\n if (uStrobe > 0.01) { float f = step(0.5, fract(uTime * uStrobe)); col *= mix(1.0, f, 0.7); }\n gl_FragColor = vec4(col, 1.0);\n }\n", z = {
384
385
  none: 0,
385
386
  kaleido: 1,
386
387
  mirrorX: 2,
387
388
  mirrorY: 3,
388
389
  quad: 4
389
- }, z = class extends x {
390
+ }, ee = class extends S {
390
391
  _setup() {
391
- this.camera = new r(-1, 1, 1, -1, 0, 1), this.scene = new o(), this.geo = new e(2, 2), this.mat = new a({
392
- vertexShader: b,
393
- fragmentShader: L,
392
+ this.camera = new g(-1, 1, 1, -1, 0, 1), this.scene = new n(), this.geo = new u(2, 2), this.mat = new t({
393
+ vertexShader: x,
394
+ fragmentShader: R,
394
395
  uniforms: {
395
396
  uImage: { value: null },
396
- uScale: { value: new c(1, 1) },
397
- uOffset: { value: new c(0, 0) },
397
+ uScale: { value: new s(1, 1) },
398
+ uOffset: { value: new s(0, 0) },
398
399
  uTime: { value: 0 },
399
- uOrigin: { value: new c(.5, .5) },
400
- uZoomV: { value: new c(1, 1) },
401
- uPan: { value: new c(0, 0) },
402
- uDrift: { value: new c(0, 0) },
400
+ uOrigin: { value: new s(.5, .5) },
401
+ uZoomV: { value: new s(1, 1) },
402
+ uPan: { value: new s(0, 0) },
403
+ uDrift: { value: new s(0, 0) },
403
404
  uRot: { value: 0 },
404
405
  uSpin: { value: .1 },
405
406
  uTwist: { value: 0 },
@@ -413,7 +414,7 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
413
414
  uSat: { value: 1 },
414
415
  uLock: { value: 0 }
415
416
  }
416
- }), this.quad = new n(this.geo, this.mat), this.scene.add(this.quad);
417
+ }), this.quad = new f(this.geo, this.mat), this.scene.add(this.quad);
417
418
  }
418
419
  _applyFit() {
419
420
  let { sx: e, sy: t, ox: n, oy: r } = this.coverFit();
@@ -424,7 +425,7 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
424
425
  }
425
426
  _onParams() {
426
427
  let e = this.params, t = this.mat.uniforms;
427
- t.uMirror.value = R[e.mirror] ?? 1, t.uSeg.value = e.segments ?? 6, t.uTwist.value = e.twist ?? 0, t.uOrigin.value.set(e.originX ?? .5, e.originY ?? .5), t.uZoomV.value.set(e.zoomX ?? 1, e.zoomY ?? 1), t.uPan.value.set(e.panX ?? 0, e.panY ?? 0), t.uDrift.value.set(e.driftX ?? 0, e.driftY ?? 0), t.uRot.value = e.rotate ?? 0, t.uSpin.value = e.spin ?? .1, t.uPulse.value = e.pulse ?? 0, t.uPulseRate.value = e.pulseRate ?? .5, t.uHue.value = e.hue ?? .3, t.uPost.value = e.posterize ?? 0, t.uStrobe.value = e.strobe ?? 0, t.uSat.value = e.sat ?? 1, t.uLock.value = e.palette ?? 0;
428
+ t.uMirror.value = z[e.mirror] ?? 1, t.uSeg.value = e.segments ?? 6, t.uTwist.value = e.twist ?? 0, t.uOrigin.value.set(e.originX ?? .5, e.originY ?? .5), t.uZoomV.value.set(e.zoomX ?? 1, e.zoomY ?? 1), t.uPan.value.set(e.panX ?? 0, e.panY ?? 0), t.uDrift.value.set(e.driftX ?? 0, e.driftY ?? 0), t.uRot.value = e.rotate ?? 0, t.uSpin.value = e.spin ?? .1, t.uPulse.value = e.pulse ?? 0, t.uPulseRate.value = e.pulseRate ?? .5, t.uHue.value = e.hue ?? .3, t.uPost.value = e.posterize ?? 0, t.uStrobe.value = e.strobe ?? 0, t.uSat.value = e.sat ?? 1, t.uLock.value = e.palette ?? 0;
428
429
  }
429
430
  _resize() {
430
431
  this._applyFit();
@@ -439,7 +440,7 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
439
440
  _dispose() {
440
441
  this.mat.dispose(), this.geo.dispose();
441
442
  }
442
- }, ee = Math.PI * 2, B = {
443
+ }, B = Math.PI * 2, V = {
443
444
  off: null,
444
445
  orbit: (e, t) => [.5 + t * Math.cos(e), .5 + t * Math.sin(e)],
445
446
  figure8: (e, t) => [.5 + t * Math.sin(e), .5 + t * Math.sin(2 * e) * .5],
@@ -449,62 +450,62 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
449
450
  let n = t * (.55 + .45 * Math.sin(e * .25));
450
451
  return [.5 + n * Math.cos(e), .5 + n * Math.sin(e)];
451
452
  }
452
- }, V = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position.xy, 0.0, 1.0);\n }\n", H = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uPrev;\n uniform vec2 uMouse;\n uniform float uRadius;\n uniform float uDecay;\n uniform float uAspect;\n uniform float uActive;\n void main() {\n float prev = texture2D(uPrev, vUv).r;\n vec2 d = vUv - uMouse;\n d.x *= uAspect;\n float blob = smoothstep(uRadius, 0.0, length(d)) * uActive;\n float v = max(prev * uDecay, blob);\n gl_FragColor = vec4(vec3(v), 1.0);\n }\n", U = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uImage;\n uniform sampler2D uTrail;\n uniform vec2 uImageScale;\n uniform vec2 uImageOffset;\n uniform float uStrength;\n uniform float uRGBShift;\n uniform vec2 uTexel;\n void main() {\n // Trail intensity at this pixel, plus its gradient (points toward the\n // cursor's bright centre → the refraction direction).\n float t = texture2D(uTrail, vUv).r;\n float tL = texture2D(uTrail, vUv - vec2(uTexel.x, 0.0)).r;\n float tR = texture2D(uTrail, vUv + vec2(uTexel.x, 0.0)).r;\n float tD = texture2D(uTrail, vUv - vec2(0.0, uTexel.y)).r;\n float tU = texture2D(uTrail, vUv + vec2(0.0, uTexel.y)).r;\n vec2 grad = vec2(tR - tL, tU - tD);\n vec2 dir = length(grad) > 1e-5 ? normalize(grad) : vec2(0.0);\n\n vec2 disp = grad * uStrength;\n // Chromatic aberration — R/G/B read at positions offset along the trail\n // direction, magnitude = trail intensity x shift.\n vec2 chroma = dir * t * uRGBShift;\n\n vec2 base = vUv * uImageScale + uImageOffset;\n float r = texture2D(uImage, base + disp + chroma).r;\n float g = texture2D(uImage, base + disp).g;\n float b = texture2D(uImage, base + disp - chroma).b;\n gl_FragColor = vec4(r, g, b, 1.0);\n }\n", W = .5, G = class {
453
- constructor(i, { autoLoop: u = !1 } = {}) {
454
- this.canvas = i, this.autoLoop = u, this.renderer = new s({
455
- canvas: i,
453
+ }, H = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position.xy, 0.0, 1.0);\n }\n", U = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uPrev;\n uniform vec2 uMouse;\n uniform float uRadius;\n uniform float uDecay;\n uniform float uAspect;\n uniform float uActive;\n void main() {\n float prev = texture2D(uPrev, vUv).r;\n vec2 d = vUv - uMouse;\n d.x *= uAspect;\n float blob = smoothstep(uRadius, 0.0, length(d)) * uActive;\n float v = max(prev * uDecay, blob);\n gl_FragColor = vec4(vec3(v), 1.0);\n }\n", W = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uImage;\n uniform sampler2D uTrail;\n uniform vec2 uImageScale;\n uniform vec2 uImageOffset;\n uniform float uStrength;\n uniform float uRGBShift;\n uniform vec2 uTexel;\n void main() {\n // Trail intensity at this pixel, plus its gradient (points toward the\n // cursor's bright centre → the refraction direction).\n float t = texture2D(uTrail, vUv).r;\n float tL = texture2D(uTrail, vUv - vec2(uTexel.x, 0.0)).r;\n float tR = texture2D(uTrail, vUv + vec2(uTexel.x, 0.0)).r;\n float tD = texture2D(uTrail, vUv - vec2(0.0, uTexel.y)).r;\n float tU = texture2D(uTrail, vUv + vec2(0.0, uTexel.y)).r;\n vec2 grad = vec2(tR - tL, tU - tD);\n vec2 dir = length(grad) > 1e-5 ? normalize(grad) : vec2(0.0);\n\n vec2 disp = grad * uStrength;\n // Chromatic aberration — R/G/B read at positions offset along the trail\n // direction, magnitude = trail intensity x shift.\n vec2 chroma = dir * t * uRGBShift;\n\n vec2 base = vUv * uImageScale + uImageOffset;\n float r = texture2D(uImage, base + disp + chroma).r;\n float g = texture2D(uImage, base + disp).g;\n float b = texture2D(uImage, base + disp - chroma).b;\n gl_FragColor = vec4(r, g, b, 1.0);\n }\n", G = .5, K = class {
454
+ constructor(e, { autoLoop: a = !1 } = {}) {
455
+ this.canvas = e, this.autoLoop = a, this.renderer = new d({
456
+ canvas: e,
456
457
  antialias: !1,
457
458
  alpha: !0,
458
459
  preserveDrawingBuffer: !0
459
- }), this.renderer.setClearColor(0, 0), this.camera = new r(-1, 1, 1, -1, 0, 1), this.scene = new o(), this.geo = new e(2, 2), this.target = new c(.5, .5), this.eased = new c(.5, .5), this.active = 0, this.params = {
460
+ }), this.renderer.setClearColor(0, 0), this.camera = new g(-1, 1, 1, -1, 0, 1), this.scene = new n(), this.geo = new u(2, 2), this.target = new s(.5, .5), this.eased = new s(.5, .5), this.active = 0, this.params = {
460
461
  strength: .25,
461
462
  radius: .18,
462
463
  decay: .94,
463
464
  rgbShift: .03
464
- }, this.size = new c(1, 1), this.imageAspect = 1, this.texture = null, this._raf = null, this.paused = !1, this.timeScale = 1, this.motion = {
465
+ }, this.size = new s(1, 1), this.imageAspect = 1, this.texture = null, this._raf = null, this.paused = !1, this.timeScale = 1, this.motion = {
465
466
  shape: "off",
466
467
  speed: 1,
467
468
  size: .6,
468
469
  pulse: 0
469
470
  }, this.time = 0, this.last = performance.now(), this.cursorPath = [], this.cursorDur = 0, this.cursorReplay = !1, this._recording = !1, this._recBuf = null, this._recStart = 0, this._onCanvasMove = null, this._paramPathRef = void 0, this.onCursorPath = null;
470
- let d = {
471
- minFilter: t,
472
- magFilter: t,
471
+ let o = {
472
+ minFilter: r,
473
+ magFilter: r,
473
474
  depthBuffer: !1,
474
475
  stencilBuffer: !1
475
476
  };
476
- this.rtA = new l(2, 2, d), this.rtB = new l(2, 2, d), this.trailMat = new a({
477
- vertexShader: V,
478
- fragmentShader: H,
477
+ this.rtA = new i(2, 2, o), this.rtB = new i(2, 2, o), this.trailMat = new t({
478
+ vertexShader: H,
479
+ fragmentShader: U,
479
480
  uniforms: {
480
481
  uPrev: { value: null },
481
- uMouse: { value: new c(.5, .5) },
482
+ uMouse: { value: new s(.5, .5) },
482
483
  uRadius: { value: this.params.radius },
483
484
  uDecay: { value: this.params.decay },
484
485
  uAspect: { value: 1 },
485
486
  uActive: { value: 0 }
486
487
  }
487
- }), this.displayMat = new a({
488
- vertexShader: V,
489
- fragmentShader: U,
488
+ }), this.displayMat = new t({
489
+ vertexShader: H,
490
+ fragmentShader: W,
490
491
  uniforms: {
491
492
  uImage: { value: null },
492
493
  uTrail: { value: null },
493
- uImageScale: { value: new c(1, 1) },
494
- uImageOffset: { value: new c(0, 0) },
494
+ uImageScale: { value: new s(1, 1) },
495
+ uImageOffset: { value: new s(0, 0) },
495
496
  uStrength: { value: this.params.strength },
496
497
  uRGBShift: { value: this.params.rgbShift },
497
- uTexel: { value: new c(.5, .5) }
498
+ uTexel: { value: new s(.5, .5) }
498
499
  }
499
- }), this.quad = new n(this.geo, this.trailMat), this.scene.add(this.quad), this._clearTargets(), this.autoLoop && this.start();
500
+ }), this.quad = new f(this.geo, this.trailMat), this.scene.add(this.quad), this._clearTargets(), this.autoLoop && this.start();
500
501
  }
501
502
  _clearTargets() {
502
503
  this.renderer.setRenderTarget(this.rtA), this.renderer.clear(), this.renderer.setRenderTarget(this.rtB), this.renderer.clear(), this.renderer.setRenderTarget(null);
503
504
  }
504
505
  setSource(e) {
505
506
  this.texture && this.texture.dispose();
506
- let n = new g(e);
507
- n.minFilter = t, n.magFilter = t, n.wrapS = p, n.wrapT = p, this.texture = n, this.imageAspect = (e.width || 1) / (e.height || 1), this.displayMat.uniforms.uImage.value = n, this._updateFit();
507
+ let t = new h(e);
508
+ t.minFilter = r, t.magFilter = r, t.wrapS = l, t.wrapT = l, this.texture = t, this.imageAspect = (e.width || 1) / (e.height || 1), this.displayMat.uniforms.uImage.value = t, this._updateFit();
508
509
  }
509
510
  touchSource() {
510
511
  this.texture && (this.texture.needsUpdate = !0);
@@ -571,12 +572,12 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
571
572
  reset() {
572
573
  this.time = 0, this._clearTargets();
573
574
  }
574
- resize(e, t) {
575
- if (e < 1 || t < 1) return;
576
- let n = Math.min(window.devicePixelRatio || 1, 2);
577
- this.renderer.setPixelRatio(n), this.renderer.setSize(e, t, !1);
578
- let r = Math.max(2, Math.round(e * W)), i = Math.max(2, Math.round(t * W));
579
- this.rtA.setSize(r, i), this.rtB.setSize(r, i), this.size.set(e, t), this.trailMat.uniforms.uAspect.value = e / t, this.displayMat.uniforms.uTexel.value.set(1 / r, 1 / i), this._updateFit(), this._clearTargets();
575
+ resize(t, n) {
576
+ if (t < 1 || n < 1) return;
577
+ let r = e();
578
+ this.renderer.setPixelRatio(r), this.renderer.setSize(t, n, !1);
579
+ let i = Math.max(2, Math.round(t * G)), a = Math.max(2, Math.round(n * G));
580
+ this.rtA.setSize(i, a), this.rtB.setSize(i, a), this.size.set(t, n), this.trailMat.uniforms.uAspect.value = t / n, this.displayMat.uniforms.uTexel.value.set(1 / i, 1 / a), this._updateFit(), this._clearTargets();
580
581
  }
581
582
  _updateFit() {
582
583
  let e = this.size.x / this.size.y, t, n;
@@ -598,12 +599,12 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
598
599
  let e = t == null ? this.cursorDur ? (this.time % this.cursorDur + this.cursorDur) % this.cursorDur / this.cursorDur : 0 : (t % 1 + 1) % 1, [r, i] = this._sampleCursor(e);
599
600
  this.target.set(r, i), this.active = 1, n = !0;
600
601
  }
601
- let r = n ? null : B[this.motion.shape];
602
+ let r = n ? null : V[this.motion.shape];
602
603
  if (r) {
603
604
  let [e, t] = r(this.time * this.motion.speed, this.motion.size * .5);
604
605
  this.target.set(e, t), this.active = 1;
605
606
  }
606
- let i = this.motion.pulse ? 1 + this.motion.pulse * Math.sin(this.time * ee * .5 * this.motion.speed) : 1;
607
+ let i = this.motion.pulse ? 1 + this.motion.pulse * Math.sin(this.time * B * .5 * this.motion.speed) : 1;
607
608
  if (this.trailMat.uniforms.uRadius.value = this.params.radius * i, !this.paused && e > 0 || this.active > .001) {
608
609
  this.eased.lerp(this.target, .12 * this.timeScale), this.quad.material = this.trailMat, this.trailMat.uniforms.uPrev.value = this.rtA.texture, this.trailMat.uniforms.uMouse.value.copy(this.eased), this.trailMat.uniforms.uActive.value = this.active, this.renderer.setRenderTarget(this.rtB), this.renderer.render(this.scene, this.camera);
609
610
  let e = this.rtA;
@@ -614,26 +615,26 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
614
615
  dispose() {
615
616
  this._onCanvasMove && this.canvas && this.canvas.removeEventListener("pointermove", this._onCanvasMove), this._onCanvasMove = null, this._raf && cancelAnimationFrame(this._raf), this._raf = null, this.rtA.dispose(), this.rtB.dispose(), this.trailMat.dispose(), this.displayMat.dispose(), this.geo.dispose(), this.texture && this.texture.dispose(), this.renderer.dispose();
616
617
  }
617
- }, K = {
618
+ }, q = {
618
619
  glass: 0,
619
620
  ripple: 1,
620
621
  ice: 2,
621
622
  mirror: 3,
622
623
  kaleido: 4,
623
624
  waves: 5
624
- }, q = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", J = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uPhoto;\n uniform float uHasPhoto, uTime, uScale, uDepth, uChromatic, uFrost, uSheen, uViewAspect, uImgAspect;\n uniform float uLightAngle, uTintAmt, uReflect, uFit, uZoom;\n uniform float uSize, uRadius, uEdge, uMagnify;\n uniform vec2 uOffset, uGlassPos;\n uniform vec3 uTint, uBg;\n uniform int uType, uShape;\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }\n float noise(vec2 p){\n vec2 i=floor(p), f=fract(p); vec2 u=f*f*(3.0-2.0*f);\n return mix(mix(hash(i),hash(i+vec2(1.0,0.0)),u.x),\n mix(hash(i+vec2(0.0,1.0)),hash(i+vec2(1.0,1.0)),u.x), u.y);\n }\n float fbm(vec2 p){ float v=0.0,a=0.5; for(int i=0;i<4;i++){ v+=a*noise(p); p*=2.0; a*=0.5; } return v; }\n\n // ---- LAYER 2 : the glass surface. Height field per surface character. ----\n float H(vec2 uv){\n float t = uTime;\n float f = 1.0 + uScale*6.0;\n if(uType==1){ // ripple — concentric water rings\n float r = length(uv-0.5);\n return sin(r*f*16.0 - t*2.0)*0.5+0.5;\n } else if(uType==2){ // ice — faceted (quantized fbm)\n float n = fbm(uv*f*3.0 + t*0.15);\n return floor(n*7.0)/7.0;\n } else if(uType==3){ // liquid metal — low freq flowing\n return fbm(uv*f*0.7 + t*0.1);\n } else if(uType==4){ // mirror — banded ridges (hall-of-mirrors folds)\n float n = fbm(uv*f*1.2 + t*0.1);\n return abs(sin((uv.x*0.6+uv.y*0.4)*f*10.0 + n*3.0 - t));\n } else if(uType==5){ // waves — directional water, fbm-perturbed\n float n = fbm(uv*f*1.5 + t*0.2);\n return sin((uv.x+uv.y)*f*9.0 + n*4.0 - t*1.6)*0.5+0.5;\n }\n return fbm(uv*f + t*0.12); // glass — organic bumps\n }\n\n // ---- LAYER 1 : the photo, placed in the frame (fit / zoom / offset). ----\n // Returns the image uv; inside-flag tells if it's within [0,1] (contain bars).\n vec2 placeUV(vec2 uv, out bool inside){\n vec2 sCover = uViewAspect > uImgAspect ? vec2(1.0, uImgAspect/uViewAspect) : vec2(uViewAspect/uImgAspect, 1.0);\n vec2 sContain = uViewAspect > uImgAspect ? vec2(uViewAspect/uImgAspect, 1.0) : vec2(1.0, uImgAspect/uViewAspect);\n vec2 s = mix(sCover, sContain, step(0.5, uFit));\n vec2 p = (uv - 0.5) * s / max(uZoom, 0.01) + 0.5 - uOffset;\n inside = p.x > 0.0 && p.x < 1.0 && p.y > 0.0 && p.y < 1.0;\n return p;\n }\n // Sample the photo at a screen-uv; outside the image (contain) gives bg colour.\n vec3 samplePhoto(vec2 uv){\n bool inside; vec2 p = placeUV(uv, inside);\n if(!inside && uFit > 0.5) return uBg;\n return texture2D(uPhoto, clamp(p, 0.001, 0.999)).rgb;\n }\n\n // ---- LAYER 2 bounds : the glass OBJECT. Signed distance, <0 = inside. ----\n float glassSDF(vec2 uv){\n vec2 p = (uv - uGlassPos);\n p.x *= uViewAspect;\n if(uShape == 1){ // circle / lens\n return length(p) - uSize;\n }\n vec2 d = abs(p) - vec2(uSize) + uRadius;\n return min(max(d.x, d.y), 0.0) + length(max(d, 0.0)) - uRadius;\n }\n\n void main(){\n vec2 uv = vUv;\n if(uHasPhoto < 0.5){ gl_FragColor = vec4(0.02,0.025,0.04,1.0); return; }\n\n // === LAYER 1 — the photo, plain. Shows AROUND the glass. ===\n vec3 bg = samplePhoto(uv);\n\n float sd = glassSDF(uv);\n float inside = 1.0 - smoothstep(-0.004, 0.004, sd);\n\n // === LAYER 2 — the photo seen THROUGH the glass (refracted) ===\n float e = 0.004;\n vec2 grad = vec2(H(uv+vec2(e,0.0))-H(uv-vec2(e,0.0)), H(uv+vec2(0.0,e))-H(uv-vec2(0.0,e)));\n vec2 off = grad * uDepth * 8.0;\n float disp = uChromatic*0.0025 * (0.4 + uDepth*30.0);\n float mag = 1.0 + uMagnify + uDepth*3.0;\n vec2 guv = (uv - uGlassPos)/mag + uGlassPos - off;\n\n vec3 refr = vec3(\n samplePhoto(guv - off*disp).r,\n samplePhoto(guv).g,\n samplePhoto(guv + off*disp).b\n );\n if(uFrost > 0.001){\n vec3 acc = refr; float r = uFrost*0.01;\n acc += samplePhoto(guv + vec2(r,0.0));\n acc += samplePhoto(guv + vec2(-r,0.0));\n acc += samplePhoto(guv + vec2(0.0,r));\n acc += samplePhoto(guv + vec2(0.0,-r));\n refr = mix(refr, acc/5.0, clamp(uFrost*0.12, 0.0, 1.0));\n }\n refr = mix(refr, refr * uTint, uTintAmt);\n\n vec2 lightDir = vec2(cos(uLightAngle), sin(uLightAngle));\n float facing = clamp(dot(normalize(grad + 1e-5), lightDir), 0.0, 1.0);\n float steep = clamp(length(grad) * 18.0, 0.0, 1.0);\n refr += uReflect * (H(uv) - 0.5) * 0.8;\n refr += (pow(steep, 1.5) * 0.5 + pow(facing, 3.0)) * steep * uSheen;\n\n // === composite: glass object OVER the photo ===\n vec3 col = mix(bg, refr, inside);\n\n float rim = 1.0 - smoothstep(0.0, max(uEdge, 0.001), abs(sd));\n float lit = 0.5 + 0.5*dot(normalize(uv - uGlassPos + 1e-5), lightDir);\n col += rim * (0.35 + 0.65*lit) * (0.5 + uSheen);\n\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n", Y = {
625
- trails: T,
626
- scan: A,
627
- slitscan: I,
628
- disco: z,
629
- distort: G,
625
+ }, J = "\n varying vec2 vUv;\n void main(){ vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }\n", Y = "\n precision highp float;\n varying vec2 vUv;\n uniform sampler2D uPhoto;\n uniform float uHasPhoto, uTime, uScale, uDepth, uChromatic, uFrost, uSheen, uViewAspect, uImgAspect;\n uniform float uLightAngle, uTintAmt, uReflect, uFit, uZoom;\n uniform float uSize, uRadius, uEdge, uMagnify;\n uniform vec2 uOffset, uGlassPos;\n uniform vec3 uTint, uBg;\n uniform int uType, uShape;\n\n float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }\n float noise(vec2 p){\n vec2 i=floor(p), f=fract(p); vec2 u=f*f*(3.0-2.0*f);\n return mix(mix(hash(i),hash(i+vec2(1.0,0.0)),u.x),\n mix(hash(i+vec2(0.0,1.0)),hash(i+vec2(1.0,1.0)),u.x), u.y);\n }\n float fbm(vec2 p){ float v=0.0,a=0.5; for(int i=0;i<4;i++){ v+=a*noise(p); p*=2.0; a*=0.5; } return v; }\n\n // ---- LAYER 2 : the glass surface. Height field per surface character. ----\n float H(vec2 uv){\n float t = uTime;\n float f = 1.0 + uScale*6.0;\n if(uType==1){ // ripple — concentric water rings\n float r = length(uv-0.5);\n return sin(r*f*16.0 - t*2.0)*0.5+0.5;\n } else if(uType==2){ // ice — faceted (quantized fbm)\n float n = fbm(uv*f*3.0 + t*0.15);\n return floor(n*7.0)/7.0;\n } else if(uType==3){ // liquid metal — low freq flowing\n return fbm(uv*f*0.7 + t*0.1);\n } else if(uType==4){ // mirror — banded ridges (hall-of-mirrors folds)\n float n = fbm(uv*f*1.2 + t*0.1);\n return abs(sin((uv.x*0.6+uv.y*0.4)*f*10.0 + n*3.0 - t));\n } else if(uType==5){ // waves — directional water, fbm-perturbed\n float n = fbm(uv*f*1.5 + t*0.2);\n return sin((uv.x+uv.y)*f*9.0 + n*4.0 - t*1.6)*0.5+0.5;\n }\n return fbm(uv*f + t*0.12); // glass — organic bumps\n }\n\n // ---- LAYER 1 : the photo, placed in the frame (fit / zoom / offset). ----\n // Returns the image uv; inside-flag tells if it's within [0,1] (contain bars).\n vec2 placeUV(vec2 uv, out bool inside){\n vec2 sCover = uViewAspect > uImgAspect ? vec2(1.0, uImgAspect/uViewAspect) : vec2(uViewAspect/uImgAspect, 1.0);\n vec2 sContain = uViewAspect > uImgAspect ? vec2(uViewAspect/uImgAspect, 1.0) : vec2(1.0, uImgAspect/uViewAspect);\n vec2 s = mix(sCover, sContain, step(0.5, uFit));\n vec2 p = (uv - 0.5) * s / max(uZoom, 0.01) + 0.5 - uOffset;\n inside = p.x > 0.0 && p.x < 1.0 && p.y > 0.0 && p.y < 1.0;\n return p;\n }\n // Sample the photo at a screen-uv; outside the image (contain) gives bg colour.\n vec3 samplePhoto(vec2 uv){\n bool inside; vec2 p = placeUV(uv, inside);\n if(!inside && uFit > 0.5) return uBg;\n return texture2D(uPhoto, clamp(p, 0.001, 0.999)).rgb;\n }\n\n // ---- LAYER 2 bounds : the glass OBJECT. Signed distance, <0 = inside. ----\n float glassSDF(vec2 uv){\n vec2 p = (uv - uGlassPos);\n p.x *= uViewAspect;\n if(uShape == 1){ // circle / lens\n return length(p) - uSize;\n }\n vec2 d = abs(p) - vec2(uSize) + uRadius;\n return min(max(d.x, d.y), 0.0) + length(max(d, 0.0)) - uRadius;\n }\n\n void main(){\n vec2 uv = vUv;\n if(uHasPhoto < 0.5){ gl_FragColor = vec4(0.02,0.025,0.04,1.0); return; }\n\n // === LAYER 1 — the photo, plain. Shows AROUND the glass. ===\n vec3 bg = samplePhoto(uv);\n\n float sd = glassSDF(uv);\n float inside = 1.0 - smoothstep(-0.004, 0.004, sd);\n\n // === LAYER 2 — the photo seen THROUGH the glass (refracted) ===\n float e = 0.004;\n vec2 grad = vec2(H(uv+vec2(e,0.0))-H(uv-vec2(e,0.0)), H(uv+vec2(0.0,e))-H(uv-vec2(0.0,e)));\n vec2 off = grad * uDepth * 8.0;\n float disp = uChromatic*0.0025 * (0.4 + uDepth*30.0);\n float mag = 1.0 + uMagnify + uDepth*3.0;\n vec2 guv = (uv - uGlassPos)/mag + uGlassPos - off;\n\n vec3 refr = vec3(\n samplePhoto(guv - off*disp).r,\n samplePhoto(guv).g,\n samplePhoto(guv + off*disp).b\n );\n if(uFrost > 0.001){\n vec3 acc = refr; float r = uFrost*0.01;\n acc += samplePhoto(guv + vec2(r,0.0));\n acc += samplePhoto(guv + vec2(-r,0.0));\n acc += samplePhoto(guv + vec2(0.0,r));\n acc += samplePhoto(guv + vec2(0.0,-r));\n refr = mix(refr, acc/5.0, clamp(uFrost*0.12, 0.0, 1.0));\n }\n refr = mix(refr, refr * uTint, uTintAmt);\n\n vec2 lightDir = vec2(cos(uLightAngle), sin(uLightAngle));\n float facing = clamp(dot(normalize(grad + 1e-5), lightDir), 0.0, 1.0);\n float steep = clamp(length(grad) * 18.0, 0.0, 1.0);\n refr += uReflect * (H(uv) - 0.5) * 0.8;\n refr += (pow(steep, 1.5) * 0.5 + pow(facing, 3.0)) * steep * uSheen;\n\n // === composite: glass object OVER the photo ===\n vec3 col = mix(bg, refr, inside);\n\n float rim = 1.0 - smoothstep(0.0, max(uEdge, 0.001), abs(sd));\n float lit = 0.5 + 0.5*dot(normalize(uv - uGlassPos + 1e-5), lightDir);\n col += rim * (0.35 + 0.65*lit) * (0.5 + uSheen);\n\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n", X = {
626
+ trails: E,
627
+ scan: j,
628
+ slitscan: L,
629
+ disco: ee,
630
+ distort: K,
630
631
  lens: class {
631
- constructor(t, { autoLoop: r = !1 } = {}) {
632
- this.canvas = t, this.autoLoop = r, this.playing = !0, this.time = 0, this.flow = 1, this._raf = null, this.last = performance.now(), this.renderer = new s({
633
- canvas: t,
632
+ constructor(e, { autoLoop: r = !1 } = {}) {
633
+ this.canvas = e, this.autoLoop = r, this.playing = !0, this.time = 0, this.flow = 1, this._raf = null, this.last = performance.now(), this.renderer = new d({
634
+ canvas: e,
634
635
  antialias: !0,
635
636
  preserveDrawingBuffer: !0
636
- }), this.scene = new o(), this.cam = new d(), this.uniforms = {
637
+ }), this.scene = new n(), this.cam = new _(), this.uniforms = {
637
638
  uPhoto: { value: null },
638
639
  uHasPhoto: { value: 0 },
639
640
  uTime: { value: 0 },
@@ -644,29 +645,29 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
644
645
  uFrost: { value: 0 },
645
646
  uSheen: { value: .5 },
646
647
  uLightAngle: { value: Math.PI * .25 },
647
- uTint: { value: new h(1, 1, 1) },
648
+ uTint: { value: new a(1, 1, 1) },
648
649
  uTintAmt: { value: 0 },
649
650
  uReflect: { value: 0 },
650
651
  uFit: { value: 0 },
651
652
  uZoom: { value: 1 },
652
- uOffset: { value: new c(0, 0) },
653
- uBg: { value: new h(.02, .025, .04) },
653
+ uOffset: { value: new s(0, 0) },
654
+ uBg: { value: new a(.02, .025, .04) },
654
655
  uShape: { value: 0 },
655
656
  uSize: { value: .45 },
656
657
  uRadius: { value: .08 },
657
658
  uEdge: { value: .02 },
658
659
  uMagnify: { value: .1 },
659
- uGlassPos: { value: new c(.5, .5) },
660
+ uGlassPos: { value: new s(.5, .5) },
660
661
  uViewAspect: { value: 1 },
661
662
  uImgAspect: { value: 1 }
662
- }, this.mat = new a({
663
- vertexShader: q,
664
- fragmentShader: J,
663
+ }, this.mat = new t({
664
+ vertexShader: J,
665
+ fragmentShader: Y,
665
666
  uniforms: this.uniforms
666
- }), this.geo = new e(2, 2), this.scene.add(new n(this.geo, this.mat)), this.autoLoop && this.start();
667
+ }), this.geo = new u(2, 2), this.scene.add(new f(this.geo, this.mat)), this.autoLoop && this.start();
667
668
  }
668
- resize(e, t) {
669
- !this.renderer || e < 1 || t < 1 || (this.renderer.setPixelRatio(Math.min(2, window.devicePixelRatio || 1)), this.renderer.setSize(e, t, !1), this.uniforms.uViewAspect.value = e / t);
669
+ resize(t, n) {
670
+ !this.renderer || t < 1 || n < 1 || (this.renderer.setPixelRatio(e()), this.renderer.setSize(t, n, !1), this.uniforms.uViewAspect.value = t / n);
670
671
  }
671
672
  setSource(e) {
672
673
  if (!this.uniforms) return;
@@ -674,15 +675,15 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
674
675
  this.uniforms.uHasPhoto.value = 0;
675
676
  return;
676
677
  }
677
- let n = new g(e);
678
- n.minFilter = t, n.magFilter = t, n.wrapS = n.wrapT = p, this.tex && this.tex.dispose(), this.tex = n, this.uniforms.uPhoto.value = n, this.uniforms.uHasPhoto.value = 1, this.uniforms.uImgAspect.value = (e.width || 1) / (e.height || 1);
678
+ let t = new h(e);
679
+ t.minFilter = r, t.magFilter = r, t.wrapS = t.wrapT = l, this.tex && this.tex.dispose(), this.tex = t, this.uniforms.uPhoto.value = t, this.uniforms.uHasPhoto.value = 1, this.uniforms.uImgAspect.value = (e.width || 1) / (e.height || 1);
679
680
  }
680
681
  touchSource() {
681
682
  this.tex && (this.tex.needsUpdate = !0);
682
683
  }
683
684
  setParams(e) {
684
685
  if (this.uniforms) {
685
- if (e.type != null && (this.uniforms.uType.value = K[e.type] ?? 0), e.scale != null && (this.uniforms.uScale.value = e.scale), e.depth != null && (this.uniforms.uDepth.value = e.depth / 1e3), e.chromatic != null && (this.uniforms.uChromatic.value = e.chromatic), e.frost != null && (this.uniforms.uFrost.value = e.frost), e.sheen != null && (this.uniforms.uSheen.value = e.sheen), e.reflect != null && (this.uniforms.uReflect.value = e.reflect), e.lightAngle != null && (this.uniforms.uLightAngle.value = e.lightAngle * Math.PI / 180), e.tint != null) {
686
+ if (e.type != null && (this.uniforms.uType.value = q[e.type] ?? 0), e.scale != null && (this.uniforms.uScale.value = e.scale), e.depth != null && (this.uniforms.uDepth.value = e.depth / 1e3), e.chromatic != null && (this.uniforms.uChromatic.value = e.chromatic), e.frost != null && (this.uniforms.uFrost.value = e.frost), e.sheen != null && (this.uniforms.uSheen.value = e.sheen), e.reflect != null && (this.uniforms.uReflect.value = e.reflect), e.lightAngle != null && (this.uniforms.uLightAngle.value = e.lightAngle * Math.PI / 180), e.tint != null) {
686
687
  let t = parseInt(e.tint.slice(1), 16);
687
688
  this.uniforms.uTint.value.set((t >> 16 & 255) / 255, (t >> 8 & 255) / 255, (t & 255) / 255);
688
689
  }
@@ -729,28 +730,28 @@ var D = "\n uniform sampler2D uImage;\n uniform float uDisplace;\n varying ve
729
730
  }
730
731
  }
731
732
  };
732
- function X(e, t) {
733
- let n = Y[e?.engine];
733
+ function Z(e, t) {
734
+ let n = X[e?.engine];
734
735
  if (!n) throw Error(`unknown gl filter engine "${e?.engine}"`);
735
736
  let r = new n(t);
736
737
  return r.controls && (r.controls.enabled = !1), r;
737
738
  }
738
- function Z(e, t, n) {
739
+ function Q(e, t, n) {
739
740
  t?.controls && (t.controls.enabled = !!n);
740
741
  }
741
- function Q(e, t, n) {
742
+ function $(e, t, n) {
742
743
  t.setSource(n);
743
744
  }
744
- function $(e, t) {
745
+ function te(e, t) {
745
746
  t.touchSource?.();
746
747
  }
747
- function te(e, t, n) {
748
+ function ne(e, t, n) {
748
749
  t.setParams(n);
749
750
  }
750
- function ne(e, t, { dt: n, u: r }) {
751
+ function re(e, t, { dt: n, u: r }) {
751
752
  t.frame(n, r);
752
753
  }
753
- function re(e) {
754
+ function ie(e) {
754
755
  if (!e) return;
755
756
  let t = e.renderer;
756
757
  try {
@@ -763,4 +764,4 @@ function re(e) {
763
764
  } catch {}
764
765
  }
765
766
  //#endregion
766
- export { te as applyParams, X as createEngine, re as destroyEngine, ne as driveEngine, Z as setCameraDrag, Q as setSource, $ as touchSource };
767
+ export { ne as applyParams, Z as createEngine, ie as destroyEngine, re as driveEngine, Q as setCameraDrag, $ as setSource, te as touchSource };