lazy-vfx 1.0.0 → 1.1.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.
@@ -1,9 +1,9 @@
1
- import ye, { useRef as D, useEffect as ge, forwardRef as Re, useState as Ee, useImperativeHandle as Pe, useCallback as Ae, useMemo as be } from "react";
2
- import { create as he } from "zustand";
3
- import { useFrame as Se } from "@react-three/fiber";
4
- import * as p from "three";
5
- import { useControls as ae, button as ie, folder as Q } from "leva";
6
- var Z = { exports: {} }, J = {};
1
+ import he, { useRef as F, useEffect as Se, forwardRef as Ae, useState as xe, useImperativeHandle as _e, useCallback as we, useMemo as ae } from "react";
2
+ import { useFrame as ye } from "@react-three/fiber";
3
+ import { Vector3 as te, Quaternion as Re, Euler as se, Matrix4 as Me, Color as Te, PlaneGeometry as Ce, AdditiveBlending as Oe, DynamicDrawUsage as W } from "three";
4
+ import { useControls as ce, button as le, folder as Z } from "leva";
5
+ import { create as je } from "zustand";
6
+ var Q = { exports: {} }, J = {};
7
7
  /**
8
8
  * @license React
9
9
  * react-jsx-runtime.production.js
@@ -13,27 +13,27 @@ var Z = { exports: {} }, J = {};
13
13
  * This source code is licensed under the MIT license found in the
14
14
  * LICENSE file in the root directory of this source tree.
15
15
  */
16
- var se;
17
- function _e() {
18
- if (se) return J;
19
- se = 1;
20
- var n = Symbol.for("react.transitional.element"), g = Symbol.for("react.fragment");
21
- function l(o, r, a) {
22
- var E = null;
23
- if (a !== void 0 && (E = "" + a), r.key !== void 0 && (E = "" + r.key), "key" in r) {
24
- a = {};
16
+ var ue;
17
+ function ke() {
18
+ if (ue) return J;
19
+ ue = 1;
20
+ var o = Symbol.for("react.transitional.element"), v = Symbol.for("react.fragment");
21
+ function l(a, r, i) {
22
+ var p = null;
23
+ if (i !== void 0 && (p = "" + i), r.key !== void 0 && (p = "" + r.key), "key" in r) {
24
+ i = {};
25
25
  for (var c in r)
26
- c !== "key" && (a[c] = r[c]);
27
- } else a = r;
28
- return r = a.ref, {
29
- $$typeof: n,
30
- type: o,
31
- key: E,
26
+ c !== "key" && (i[c] = r[c]);
27
+ } else i = r;
28
+ return r = i.ref, {
29
+ $$typeof: o,
30
+ type: a,
31
+ key: p,
32
32
  ref: r !== void 0 ? r : null,
33
- props: a
33
+ props: i
34
34
  };
35
35
  }
36
- return J.Fragment = g, J.jsx = l, J.jsxs = l, J;
36
+ return J.Fragment = v, J.jsx = l, J.jsxs = l, J;
37
37
  }
38
38
  var q = {};
39
39
  /**
@@ -45,26 +45,26 @@ var q = {};
45
45
  * This source code is licensed under the MIT license found in the
46
46
  * LICENSE file in the root directory of this source tree.
47
47
  */
48
- var ce;
49
- function we() {
50
- return ce || (ce = 1, process.env.NODE_ENV !== "production" && (function() {
51
- function n(e) {
48
+ var fe;
49
+ function Fe() {
50
+ return fe || (fe = 1, process.env.NODE_ENV !== "production" && (function() {
51
+ function o(e) {
52
52
  if (e == null) return null;
53
53
  if (typeof e == "function")
54
- return e.$$typeof === C ? null : e.displayName || e.name || null;
54
+ return e.$$typeof === M ? null : e.displayName || e.name || null;
55
55
  if (typeof e == "string") return e;
56
56
  switch (e) {
57
- case _:
57
+ case A:
58
58
  return "Fragment";
59
- case z:
59
+ case D:
60
60
  return "Profiler";
61
- case F:
61
+ case x:
62
62
  return "StrictMode";
63
63
  case f:
64
64
  return "Suspense";
65
- case B:
65
+ case Y:
66
66
  return "SuspenseList";
67
- case T:
67
+ case w:
68
68
  return "Activity";
69
69
  }
70
70
  if (typeof e == "object")
@@ -73,64 +73,64 @@ function we() {
73
73
  ), e.$$typeof) {
74
74
  case h:
75
75
  return "Portal";
76
- case w:
76
+ case _:
77
77
  return e.displayName || "Context";
78
78
  case N:
79
79
  return (e._context.displayName || "Context") + ".Consumer";
80
- case S:
80
+ case E:
81
81
  var t = e.render;
82
82
  return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
83
- case X:
84
- return t = e.displayName || null, t !== null ? t : n(e.type) || "Memo";
85
- case A:
83
+ case $:
84
+ return t = e.displayName || null, t !== null ? t : o(e.type) || "Memo";
85
+ case y:
86
86
  t = e._payload, e = e._init;
87
87
  try {
88
- return n(e(t));
88
+ return o(e(t));
89
89
  } catch {
90
90
  }
91
91
  }
92
92
  return null;
93
93
  }
94
- function g(e) {
94
+ function v(e) {
95
95
  return "" + e;
96
96
  }
97
97
  function l(e) {
98
98
  try {
99
- g(e);
99
+ v(e);
100
100
  var t = !1;
101
101
  } catch {
102
102
  t = !0;
103
103
  }
104
104
  if (t) {
105
105
  t = console;
106
- var u = t.error, m = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
106
+ var u = t.error, d = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
107
107
  return u.call(
108
108
  t,
109
109
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
110
- m
111
- ), g(e);
110
+ d
111
+ ), v(e);
112
112
  }
113
113
  }
114
- function o(e) {
115
- if (e === _) return "<>";
116
- if (typeof e == "object" && e !== null && e.$$typeof === A)
114
+ function a(e) {
115
+ if (e === A) return "<>";
116
+ if (typeof e == "object" && e !== null && e.$$typeof === y)
117
117
  return "<...>";
118
118
  try {
119
- var t = n(e);
119
+ var t = o(e);
120
120
  return t ? "<" + t + ">" : "<...>";
121
121
  } catch {
122
122
  return "<...>";
123
123
  }
124
124
  }
125
125
  function r() {
126
- var e = L.A;
126
+ var e = C.A;
127
127
  return e === null ? null : e.getOwner();
128
128
  }
129
- function a() {
129
+ function i() {
130
130
  return Error("react-stack-top-frame");
131
131
  }
132
- function E(e) {
133
- if (I.call(e, "key")) {
132
+ function p(e) {
133
+ if (L.call(e, "key")) {
134
134
  var t = Object.getOwnPropertyDescriptor(e, "key").get;
135
135
  if (t && t.isReactWarning) return !1;
136
136
  }
@@ -148,23 +148,23 @@ function we() {
148
148
  configurable: !0
149
149
  });
150
150
  }
151
- function M() {
152
- var e = n(this.type);
153
- return W[e] || (W[e] = !0, console.error(
151
+ function T() {
152
+ var e = o(this.type);
153
+ return X[e] || (X[e] = !0, console.error(
154
154
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
155
155
  )), e = this.props.ref, e !== void 0 ? e : null;
156
156
  }
157
- function P(e, t, u, m, H, te) {
158
- var v = u.ref;
157
+ function R(e, t, u, d, H, re) {
158
+ var m = u.ref;
159
159
  return e = {
160
- $$typeof: y,
160
+ $$typeof: S,
161
161
  type: e,
162
162
  key: t,
163
163
  props: u,
164
- _owner: m
165
- }, (v !== void 0 ? v : null) !== null ? Object.defineProperty(e, "ref", {
164
+ _owner: d
165
+ }, (m !== void 0 ? m : null) !== null ? Object.defineProperty(e, "ref", {
166
166
  enumerable: !1,
167
- get: M
167
+ get: T
168
168
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
169
169
  configurable: !1,
170
170
  enumerable: !1,
@@ -184,64 +184,64 @@ function we() {
184
184
  configurable: !1,
185
185
  enumerable: !1,
186
186
  writable: !0,
187
- value: te
187
+ value: re
188
188
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
189
189
  }
190
- function d(e, t, u, m, H, te) {
191
- var v = t.children;
192
- if (v !== void 0)
193
- if (m)
194
- if (U(v)) {
195
- for (m = 0; m < v.length; m++)
196
- i(v[m]);
197
- Object.freeze && Object.freeze(v);
190
+ function n(e, t, u, d, H, re) {
191
+ var m = t.children;
192
+ if (m !== void 0)
193
+ if (d)
194
+ if (U(m)) {
195
+ for (d = 0; d < m.length; d++)
196
+ P(m[d]);
197
+ Object.freeze && Object.freeze(m);
198
198
  } else
199
199
  console.error(
200
200
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
201
201
  );
202
- else i(v);
203
- if (I.call(t, "key")) {
204
- v = n(e);
205
- var $ = Object.keys(t).filter(function(xe) {
206
- return xe !== "key";
202
+ else P(m);
203
+ if (L.call(t, "key")) {
204
+ m = o(e);
205
+ var B = Object.keys(t).filter(function(Pe) {
206
+ return Pe !== "key";
207
207
  });
208
- m = 0 < $.length ? "{key: someKey, " + $.join(": ..., ") + ": ...}" : "{key: someKey}", k[v + m] || ($ = 0 < $.length ? "{" + $.join(": ..., ") + ": ...}" : "{}", console.error(
208
+ d = 0 < B.length ? "{key: someKey, " + B.join(": ..., ") + ": ...}" : "{key: someKey}", j[m + d] || (B = 0 < B.length ? "{" + B.join(": ..., ") + ": ...}" : "{}", console.error(
209
209
  `A props object containing a "key" prop is being spread into JSX:
210
210
  let props = %s;
211
211
  <%s {...props} />
212
212
  React keys must be passed directly to JSX without using spread:
213
213
  let props = %s;
214
214
  <%s key={someKey} {...props} />`,
215
+ d,
215
216
  m,
216
- v,
217
- $,
218
- v
219
- ), k[v + m] = !0);
217
+ B,
218
+ m
219
+ ), j[m + d] = !0);
220
220
  }
221
- if (v = null, u !== void 0 && (l(u), v = "" + u), E(t) && (l(t.key), v = "" + t.key), "key" in t) {
221
+ if (m = null, u !== void 0 && (l(u), m = "" + u), p(t) && (l(t.key), m = "" + t.key), "key" in t) {
222
222
  u = {};
223
- for (var re in t)
224
- re !== "key" && (u[re] = t[re]);
223
+ for (var ne in t)
224
+ ne !== "key" && (u[ne] = t[ne]);
225
225
  } else u = t;
226
- return v && c(
226
+ return m && c(
227
227
  u,
228
228
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
229
- ), P(
229
+ ), R(
230
230
  e,
231
- v,
231
+ m,
232
232
  u,
233
233
  r(),
234
234
  H,
235
- te
235
+ re
236
236
  );
237
237
  }
238
- function i(e) {
239
- x(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === A && (e._payload.status === "fulfilled" ? x(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
238
+ function P(e) {
239
+ z(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === y && (e._payload.status === "fulfilled" ? z(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
240
240
  }
241
- function x(e) {
242
- return typeof e == "object" && e !== null && e.$$typeof === y;
241
+ function z(e) {
242
+ return typeof e == "object" && e !== null && e.$$typeof === S;
243
243
  }
244
- var s = ye, y = Symbol.for("react.transitional.element"), h = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), F = Symbol.for("react.strict_mode"), z = Symbol.for("react.profiler"), N = Symbol.for("react.consumer"), w = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), f = Symbol.for("react.suspense"), B = Symbol.for("react.suspense_list"), X = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), T = Symbol.for("react.activity"), C = Symbol.for("react.client.reference"), L = s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, I = Object.prototype.hasOwnProperty, U = Array.isArray, Y = console.createTask ? console.createTask : function() {
244
+ var s = he, S = Symbol.for("react.transitional.element"), h = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), x = Symbol.for("react.strict_mode"), D = Symbol.for("react.profiler"), N = Symbol.for("react.consumer"), _ = Symbol.for("react.context"), E = Symbol.for("react.forward_ref"), f = Symbol.for("react.suspense"), Y = Symbol.for("react.suspense_list"), $ = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), w = Symbol.for("react.activity"), M = Symbol.for("react.client.reference"), C = s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, L = Object.prototype.hasOwnProperty, U = Array.isArray, I = console.createTask ? console.createTask : function() {
245
245
  return null;
246
246
  };
247
247
  s = {
@@ -249,75 +249,54 @@ React keys must be passed directly to JSX without using spread:
249
249
  return e();
250
250
  }
251
251
  };
252
- var V, W = {}, O = s.react_stack_bottom_frame.bind(
252
+ var V, X = {}, O = s.react_stack_bottom_frame.bind(
253
253
  s,
254
- a
255
- )(), G = Y(o(a)), k = {};
256
- q.Fragment = _, q.jsx = function(e, t, u) {
257
- var m = 1e4 > L.recentlyCreatedOwnerStacks++;
258
- return d(
254
+ i
255
+ )(), G = I(a(i)), j = {};
256
+ q.Fragment = A, q.jsx = function(e, t, u) {
257
+ var d = 1e4 > C.recentlyCreatedOwnerStacks++;
258
+ return n(
259
259
  e,
260
260
  t,
261
261
  u,
262
262
  !1,
263
- m ? Error("react-stack-top-frame") : O,
264
- m ? Y(o(e)) : G
263
+ d ? Error("react-stack-top-frame") : O,
264
+ d ? I(a(e)) : G
265
265
  );
266
266
  }, q.jsxs = function(e, t, u) {
267
- var m = 1e4 > L.recentlyCreatedOwnerStacks++;
268
- return d(
267
+ var d = 1e4 > C.recentlyCreatedOwnerStacks++;
268
+ return n(
269
269
  e,
270
270
  t,
271
271
  u,
272
272
  !0,
273
- m ? Error("react-stack-top-frame") : O,
274
- m ? Y(o(e)) : G
273
+ d ? Error("react-stack-top-frame") : O,
274
+ d ? I(a(e)) : G
275
275
  );
276
276
  };
277
277
  })()), q;
278
278
  }
279
- var le;
280
- function Me() {
281
- return le || (le = 1, process.env.NODE_ENV === "production" ? Z.exports = _e() : Z.exports = we()), Z.exports;
279
+ var de;
280
+ function ze() {
281
+ return de || (de = 1, process.env.NODE_ENV === "production" ? Q.exports = ke() : Q.exports = Fe()), Q.exports;
282
282
  }
283
- var R = Me();
284
- const oe = he((n, g) => ({
285
- emitters: {},
286
- registerEmitter: (l, o) => {
287
- if (g().emitters[l]) {
288
- console.warn(`Emitter ${l} already exists`);
289
- return;
290
- }
291
- n((r) => (r.emitters[l] = o, r));
292
- },
293
- unregisterEmitter: (l) => {
294
- n((o) => (delete o.emitters[l], o));
295
- },
296
- emit: (l, ...o) => {
297
- const r = g().emitters[l];
298
- if (!r) {
299
- console.warn(`Emitter ${l} not found`);
300
- return;
301
- }
302
- r(...o);
303
- }
304
- }));
305
- function ue(n, g) {
306
- return n + Math.floor(Math.random() * (g - n + 1));
283
+ var b = ze();
284
+ function me(o, v) {
285
+ return o + Math.floor(Math.random() * (v - o + 1));
307
286
  }
308
- function b(n, g) {
309
- return n + Math.random() * (g - n);
287
+ function g(o, v) {
288
+ return o + Math.random() * (v - o);
310
289
  }
311
- const Te = ({ settings: n, onChange: g, onRestart: l }) => {
312
- ae("⚙️ Emitter Settings", {
313
- Restart: ie(() => l()),
314
- Export: ie(() => {
315
- const c = JSON.stringify(E.current);
290
+ const De = ({ settings: o, onChange: v, onRestart: l }) => {
291
+ ce("⚙️ Emitter Settings", {
292
+ Restart: le(() => l()),
293
+ Export: le(() => {
294
+ const c = JSON.stringify(p.current);
316
295
  console.log("📋 Values saved to clipboard: ", c), navigator.clipboard.writeText(c);
317
296
  })
318
297
  });
319
- const [{ ...o }, r] = ae(() => ({
320
- "🪄 Emitter": Q({
298
+ const [{ ...a }, r] = ce(() => ({
299
+ "🪄 Emitter": Z({
321
300
  duration: 4,
322
301
  delay: 0,
323
302
  nbParticles: 2e3,
@@ -355,7 +334,7 @@ const Te = ({ settings: n, onChange: g, onRestart: l }) => {
355
334
  label: "startRotationMax"
356
335
  }
357
336
  }),
358
- "✨ Particles": Q({
337
+ "✨ Particles": Z({
359
338
  particlesLifetime: {
360
339
  value: [0.1, 1],
361
340
  min: 0,
@@ -364,7 +343,7 @@ const Te = ({ settings: n, onChange: g, onRestart: l }) => {
364
343
  label: "lifetime"
365
344
  }
366
345
  }),
367
- "🌪 Forces": Q({
346
+ "🌪 Forces": Z({
368
347
  speed: {
369
348
  value: [5, 20],
370
349
  min: -100,
@@ -395,7 +374,7 @@ const Te = ({ settings: n, onChange: g, onRestart: l }) => {
395
374
  step: 0.1
396
375
  }
397
376
  }),
398
- "🎨 Appearance": Q({
377
+ "🎨 Appearance": Z({
399
378
  nbColors: {
400
379
  options: [1, 2, 3]
401
380
  },
@@ -425,119 +404,142 @@ const Te = ({ settings: n, onChange: g, onRestart: l }) => {
425
404
  label: "size"
426
405
  }
427
406
  })
428
- })), a = {
429
- ...o,
430
- colorStart: [o.colorStart],
431
- colorEnd: [o.colorEnd]
407
+ })), i = {
408
+ ...a,
409
+ colorStart: [a.colorStart],
410
+ colorEnd: [a.colorEnd]
432
411
  };
433
- delete a.nbColors, delete a.colorStart2, delete a.colorEnd2, delete a.colorStart3, delete a.colorEnd3, o.nbColors > 1 && a.colorStart.push(o.colorStart2), o.nbColors > 1 && a.colorEnd.push(o.colorEnd2), o.nbColors > 2 && a.colorStart.push(o.colorStart3), o.nbColors > 2 && a.colorEnd.push(o.colorEnd3);
434
- const E = D(a);
435
- E.current = a, ge(() => {
436
- var c, M;
437
- if (n) {
438
- const P = {
439
- ...n
412
+ delete i.nbColors, delete i.colorStart2, delete i.colorEnd2, delete i.colorStart3, delete i.colorEnd3, a.nbColors > 1 && i.colorStart.push(a.colorStart2), a.nbColors > 1 && i.colorEnd.push(a.colorEnd2), a.nbColors > 2 && i.colorStart.push(a.colorStart3), a.nbColors > 2 && i.colorEnd.push(a.colorEnd3);
413
+ const p = F(i);
414
+ p.current = i, Se(() => {
415
+ var c, T;
416
+ if (o) {
417
+ const R = {
418
+ ...o
440
419
  };
441
- for (let d = 0; d < 2; d++)
442
- ((c = n.colorStart) == null ? void 0 : c.length) > d && (P[d === 0 ? "colorStart" : `colorStart${d + 1}`] = n.colorStart[d], P.nbColors = d + 1), ((M = n.colorEnd) == null ? void 0 : M.length) > d && (P[d === 0 ? "colorEnd" : `colorEnd${d + 1}`] = n.colorEnd[d]);
420
+ for (let n = 0; n < 2; n++)
421
+ ((c = o.colorStart) == null ? void 0 : c.length) > n && (R[n === 0 ? "colorStart" : `colorStart${n + 1}`] = o.colorStart[n], R.nbColors = n + 1), ((T = o.colorEnd) == null ? void 0 : T.length) > n && (R[n === 0 ? "colorEnd" : `colorEnd${n + 1}`] = o.colorEnd[n]);
443
422
  r({
444
- ...P
423
+ ...R
445
424
  });
446
425
  }
447
- }, [n]), g(a);
448
- }, K = new p.Vector3(), ne = new p.Quaternion(), Ce = new p.Euler(), ee = new p.Euler(), Oe = new p.Vector3(), Le = Re(
449
- ({ debug: n = !1, emitter: g, settings: l = {}, ...o }, r) => {
450
- const [{
451
- duration: a = 1,
452
- nParticles: E = 1e3,
453
- spawnMode: c = "time",
454
- // time, burst
455
- loop: M = !1,
456
- delay: P = 0,
457
- colorStart: d = ["white", "skyblue"],
458
- colorEnd: i = [],
459
- particlesLifetime: x = [0.1, 1],
460
- speed: s = [5, 20],
461
- size: y = [0.1, 1],
462
- startPositionMin: h = [-1, -1, -1],
463
- startPositionMax: _ = [1, 1, 1],
464
- startRotationMin: F = [0, 0, 0],
465
- startRotationMax: z = [0, 0, 0],
466
- rotationSpeedMin: N = [0, 0, 0],
467
- rotationSpeedMax: w = [0, 0, 0],
468
- directionMin: S = [0, 0, 0],
469
- directionMax: f = [0, 0, 0]
470
- }, B] = Ee(l), X = oe((U) => U.emit), A = D();
471
- Pe(r, () => A.current);
472
- const T = D(0), C = D(0);
473
- Se(({ clock: U }, Y) => {
474
- const V = U.elapsedTime;
475
- if (C.current < E || M) {
476
- if (!A)
426
+ }, [o]), v(i);
427
+ }, ie = je((o, v) => ({
428
+ emitters: {},
429
+ registerEmitter: (l, a) => {
430
+ if (v().emitters[l]) {
431
+ console.warn(`Emitter ${l} already exists`);
432
+ return;
433
+ }
434
+ o((r) => (r.emitters[l] = a, r));
435
+ },
436
+ unregisterEmitter: (l) => {
437
+ o((a) => (delete a.emitters[l], a));
438
+ },
439
+ emit: (l, ...a) => {
440
+ const r = v().emitters[l];
441
+ if (!r) {
442
+ console.warn(`Emitter ${l} not found`);
443
+ return;
444
+ }
445
+ r(...a);
446
+ }
447
+ })), K = new te(), oe = new Re(), Ne = new se(), ee = new se(), Le = new te(), Xe = Ae(
448
+ ({ debug: o, emitter: v, settings: l = {}, ...a }, r) => {
449
+ const [
450
+ {
451
+ duration: i = 1,
452
+ nbParticles: p = 1e3,
453
+ spawnMode: c = "time",
454
+ // time, burst
455
+ loop: T = !1,
456
+ delay: R = 0,
457
+ colorStart: n = ["white", "skyblue"],
458
+ colorEnd: P = [],
459
+ particlesLifetime: z = [0.1, 1],
460
+ speed: s = [5, 20],
461
+ size: S = [0.1, 1],
462
+ startPositionMin: h = [-1, -1, -1],
463
+ startPositionMax: A = [1, 1, 1],
464
+ startRotationMin: x = [0, 0, 0],
465
+ startRotationMax: D = [0, 0, 0],
466
+ rotationSpeedMin: N = [0, 0, 0],
467
+ rotationSpeedMax: _ = [0, 0, 0],
468
+ directionMin: E = [0, 0, 0],
469
+ directionMax: f = [0, 0, 0]
470
+ },
471
+ Y
472
+ ] = xe(l), $ = ie((U) => U.emit), y = F();
473
+ _e(r, () => y.current);
474
+ const w = F(0), M = F(0);
475
+ ye(({ clock: U }, I) => {
476
+ const V = U.getElapsedTime();
477
+ if (w.current < p || T) {
478
+ if (!y)
477
479
  return;
478
- const O = (c === "burst" ? E : Math.max(
480
+ const O = (c === "burst" ? p : Math.max(
479
481
  0,
480
482
  Math.floor(
481
- (T.current - P) / a * E
483
+ (M.current - R) / i * p
482
484
  )
483
- )) - C.current;
484
- O > 0 && T.current >= P && (X(g, O, () => {
485
- A.current.updateWorldMatrix(!0), A.current.matrixWorld.decompose(K, ne, Oe), Ce.setFromQuaternion(ne), ee.setFromQuaternion(ne);
486
- const k = b(y[0], y[1]), e = d[ue(0, d.length - 1)];
485
+ )) - w.current;
486
+ O > 0 && M.current >= R && ($(v, O, () => {
487
+ y.current.updateWorldMatrix(!0), y.current.matrixWorld.decompose(K, oe, Le), Ne.setFromQuaternion(oe), ee.setFromQuaternion(oe);
488
+ const j = g(S[0], S[1]), e = n[me(0, n.length - 1)];
487
489
  return {
488
490
  position: [
489
- K.x + b(h[0], _[0]),
490
- K.y + b(h[1], _[1]),
491
- K.z + b(h[2], _[2])
491
+ K.x + g(h[0], A[0]),
492
+ K.y + g(h[1], A[1]),
493
+ K.z + g(h[2], A[2])
492
494
  ],
493
495
  direction: [
494
- b(S[0], f[0]),
495
- b(S[1], f[1]),
496
- b(S[2], f[2])
496
+ g(E[0], f[0]),
497
+ g(E[1], f[1]),
498
+ g(E[2], f[2])
497
499
  ],
498
- scale: [k, k, k],
500
+ scale: [j, j, j],
499
501
  rotation: [
500
- ee.x + b(F[0], z[0]),
501
- ee.y + b(F[1], z[1]),
502
- ee.z + b(F[2], z[2])
502
+ ee.x + g(x[0], D[0]),
503
+ ee.y + g(x[1], D[1]),
504
+ ee.z + g(x[2], D[2])
503
505
  ],
504
506
  rotationSpeed: [
505
- b(N[0], w[0]),
506
- b(N[1], w[1]),
507
- b(N[2], w[2])
507
+ g(N[0], _[0]),
508
+ g(N[1], _[1]),
509
+ g(N[2], _[2])
508
510
  ],
509
511
  lifetime: [
510
512
  V,
511
- b(x[0], x[1])
513
+ g(z[0], z[1])
512
514
  ],
513
515
  colorStart: e,
514
- colorEnd: i != null && i.length ? i[ue(0, i.length - 1)] : e,
515
- speed: [b(s[0], s[1])]
516
+ colorEnd: P != null && P.length ? P[me(0, P.length - 1)] : e,
517
+ speed: [g(s[0], s[1])]
516
518
  };
517
- }), C.current += O);
519
+ }), w.current += O);
518
520
  }
519
- T.current += Y;
521
+ M.current += I;
520
522
  });
521
- const L = Ae(() => {
522
- C.current = 0, T.current = 0;
523
- }, []), I = be(
524
- () => n ? /* @__PURE__ */ R.jsx(
525
- Te,
523
+ const C = we(() => {
524
+ w.current = 0, M.current = 0;
525
+ }, []), L = ae(
526
+ () => o ? /* @__PURE__ */ b.jsx(
527
+ De,
526
528
  {
527
529
  settings: l,
528
- onChange: B,
529
- onRestart: L
530
+ onChange: Y,
531
+ onRestart: C
530
532
  }
531
533
  ) : null,
532
- [n]
534
+ [o]
533
535
  );
534
- return /* @__PURE__ */ R.jsxs(R.Fragment, { children: [
535
- I,
536
- /* @__PURE__ */ R.jsx("object3D", { ...o, ref: A })
536
+ return /* @__PURE__ */ b.jsxs(b.Fragment, { children: [
537
+ L,
538
+ /* @__PURE__ */ b.jsx("object3D", { ...a, ref: y })
537
539
  ] });
538
540
  }
539
541
  );
540
- var ke = `varying vec2 vUv;
542
+ var Ue = `varying vec2 vUv;
541
543
  varying vec3 vColor;
542
544
  varying vec3 vColorEnd;
543
545
  varying float vProgress;
@@ -642,7 +644,7 @@ var ke = `varying vec2 vUv;
642
644
  vUv = uv;
643
645
  vColor = instanceColor;
644
646
  vColorEnd = instanceColorEnd;
645
- }`, je = `varying vec2 vUv;
647
+ }`, Ie = `varying vec2 vUv;
646
648
  varying vec3 vColor;
647
649
  varying vec3 vColorEnd;
648
650
  varying float vProgress;
@@ -668,167 +670,174 @@ var ke = `varying vec2 vUv;
668
670
  gl_FragColor = vec4(color, alpha);
669
671
  #endif
670
672
  }`;
671
- const fe = new p.Vector3(), de = new p.Euler(), me = new p.Quaternion(), ve = new p.Vector3(1, 1, 1), pe = new p.Matrix4(), j = new p.Color(), Ie = ({ name: n, settings: g = {}, alphaMap: l, geometry: o }) => {
672
- const { nParticals: r = 1e3, intensity: a = 1, renderMode: E = "mesh", fadeSize: c = [0.1, 0.9], fadeAlpha: M = [0, 1], gravity: P = [0, 0, 0] } = g, d = new p.PlaneGeometry(), i = D(), [x] = Ee({
673
- instanceColor: new Float32Array(r * 3),
674
- instanceColorEnd: new Float32Array(r * 3),
675
- instanceDirection: new Float32Array(r * 3),
676
- instanceLifetime: new Float32Array(r * 2),
677
- instanceSpeed: new Float32Array(r * 1),
678
- instanceRotationSpeed: new Float32Array(r * 3)
679
- }), s = D(0), y = D(0), h = D(!1), _ = (S, f) => {
680
- const B = i.current.geometry.getAttribute("instanceColor"), X = i.current.geometry.getAttribute("instanceColorEnd"), A = i.current.geometry.getAttribute("instanceDirection"), T = i.current.geometry.getAttribute("instanceLifetime"), C = i.current.geometry.getAttribute("instanceSpeed"), L = i.current.geometry.getAttribute(
673
+ const ve = new te(), pe = new se(), ge = new Re(), Ee = new te(1, 1, 1), be = new Me(), k = new Te(), Ge = ({ name: o, settings: v = {}, alphaMap: l, geometry: a }) => {
674
+ const {
675
+ nbParticles: r = 1e3,
676
+ intensity: i = 1,
677
+ renderMode: p = "mesh",
678
+ fadeSize: c = [0.1, 0.9],
679
+ fadeAlpha: T = [0, 1],
680
+ gravity: R = [0, 0, 0]
681
+ } = v, n = F(), P = ae(() => new Ce(0.5, 0.5), []), z = () => {
682
+ if (!h.current || !n.current)
683
+ return;
684
+ [
685
+ n.current.instanceMatrix,
686
+ n.current.geometry.getAttribute("instanceColor"),
687
+ n.current.geometry.getAttribute("instanceColorEnd"),
688
+ n.current.geometry.getAttribute("instanceDirection"),
689
+ n.current.geometry.getAttribute("instanceLifetime"),
690
+ n.current.geometry.getAttribute("instanceSpeed"),
691
+ n.current.geometry.getAttribute("instanceRotationSpeed")
692
+ ].forEach((f) => {
693
+ f.clearUpdateRanges(), S.current > s.current ? (f.addUpdateRange(0, s.current * f.itemSize), f.addUpdateRange(
694
+ S.current * f.itemSize,
695
+ r * f.itemSize - S.current * f.itemSize
696
+ )) : f.addUpdateRange(
697
+ S.current * f.itemSize,
698
+ s.current * f.itemSize - S.current * f.itemSize
699
+ ), f.needsUpdate = !0;
700
+ }), S.current = s.current, h.current = !1;
701
+ }, s = F(0), S = F(0), h = F(!1), A = (E, f) => {
702
+ const Y = n.current.geometry.getAttribute("instanceColor"), $ = n.current.geometry.getAttribute("instanceColorEnd"), y = n.current.geometry.getAttribute("instanceDirection"), w = n.current.geometry.getAttribute("instanceLifetime"), M = n.current.geometry.getAttribute("instanceSpeed"), C = n.current.geometry.getAttribute(
681
703
  "instanceRotationSpeed"
682
704
  );
683
- for (let I = 0; I < S; I++) {
705
+ for (let L = 0; L < E; L++) {
684
706
  s.current >= r && (s.current = 0);
685
707
  const {
686
708
  scale: U,
687
- rotation: Y,
709
+ rotation: I,
688
710
  rotationSpeed: V,
689
- position: W,
711
+ position: X,
690
712
  direction: O,
691
713
  lifetime: G,
692
- colorStart: k,
714
+ colorStart: j,
693
715
  colorEnd: e,
694
716
  speed: t
695
717
  } = f();
696
- fe.set(...W), de.set(...Y), me.setFromEuler(de), ve.set(...U), pe.compose(fe, me, ve), j.set(k), j.set(e), A.set(O, s.current * 3), T.set(G, s.current * 2), C.set([t], s.current), L.set(V, s.current * 3), B.set(
697
- [j.r, j.g, j.b],
718
+ ve.set(...X), pe.set(...I), ge.setFromEuler(pe), Ee.set(...U), be.compose(ve, ge, Ee), n.current.setMatrixAt(s.current, be), k.set(j), Y.set(
719
+ [k.r, k.g, k.b],
698
720
  s.current * 3
699
- ), X.set(
700
- [j.r, j.g, j.b],
721
+ ), k.set(e), $.set(
722
+ [k.r, k.g, k.b],
701
723
  s.current * 3
702
- ), i.current.setMatrixAt(s.current, pe);
724
+ ), y.set(O, s.current * 3), w.set(G, s.current * 2), M.set([t], s.current), C.set(V, s.current * 3), s.current++, s.current = s.current % r;
703
725
  }
704
- h.current = !0, s.current++, s.current = s.current % r;
705
- }, F = () => {
706
- if (!h.current || !i.current)
707
- return;
708
- [
709
- i.current.instanceMatrix,
710
- i.current.geometry.getAttribute("instanceColor"),
711
- i.current.geometry.getAttribute("instanceColorEnd"),
712
- i.current.geometry.getAttribute("instanceDirection"),
713
- i.current.geometry.getAttribute("instanceLifetime"),
714
- i.current.geometry.getAttribute("instanceSpeed"),
715
- i.current.geometry.getAttribute("instanceRotationSpeed")
716
- ].forEach((f) => {
717
- f.clearUpdateRanges(), y.current > s.current ? (f.addUpdateRange(0, s.current * f.itemSize), f.addUpdateRange(
718
- y.current * f.itemSize,
719
- r * f.itemSize - y.current * f.itemSize
720
- )) : f.addUpdateRange(
721
- y.current * f.itemSize,
722
- s.current * f.itemSize - y.current * f.itemSize
723
- ), f.needsUpdate = !0;
724
- }), y.current = s.current, h.current = !1;
725
- }, z = oe((S) => S.registerEmitter), N = oe((S) => S.unregisterEmitter);
726
- ge(() => (z(n, _), () => {
727
- N(n);
726
+ n.current.instanceMatrix.needsUpdate = !0, Y.needsUpdate = !0, $.needsUpdate = !0, y.needsUpdate = !0, w.needsUpdate = !0, M.needsUpdate = !0, C.needsUpdate = !0, h.current = !0;
727
+ }, [x] = xe({
728
+ instanceColor: new Float32Array(r * 3),
729
+ instanceColorEnd: new Float32Array(r * 3),
730
+ instanceDirection: new Float32Array(r * 3),
731
+ instanceLifetime: new Float32Array(r * 2),
732
+ instanceSpeed: new Float32Array(r * 1),
733
+ instanceRotationSpeed: new Float32Array(r * 3)
734
+ }), D = ie((E) => E.registerEmitter), N = ie((E) => E.unregisterEmitter);
735
+ Se(() => (D(o, A), () => {
736
+ N(o);
728
737
  }), []);
729
- const w = be(
738
+ const _ = ae(
730
739
  () => ({
731
740
  uTime: { value: 0 },
732
- uIntensity: { value: a },
741
+ uIntensity: { value: i },
733
742
  uFadeSize: { value: c },
734
- uFadeAlpha: { value: M },
735
- uGravity: { value: P },
743
+ uFadeAlpha: { value: T },
744
+ uGravity: { value: R },
736
745
  uAlphaMap: { value: l }
737
746
  }),
738
747
  []
739
748
  );
740
- return Se(({ clock: S }) => {
741
- w && (w.uTime.value = S.elapsedTime);
742
- }), /* @__PURE__ */ R.jsxs(
749
+ return ye(({ clock: E }) => {
750
+ _ && (_.uTime.value = E.elapsedTime);
751
+ }), /* @__PURE__ */ b.jsx(b.Fragment, { children: /* @__PURE__ */ b.jsxs(
743
752
  "instancedMesh",
744
753
  {
745
- ref: i,
746
- args: [d, null, r],
747
- onBeforeRender: F,
754
+ args: [P, null, r],
755
+ ref: n,
756
+ onBeforeRender: z,
748
757
  children: [
749
- o,
750
- /* @__PURE__ */ R.jsx(
758
+ a,
759
+ /* @__PURE__ */ b.jsx(
751
760
  "shaderMaterial",
752
761
  {
753
- uniforms: w,
754
- vertexShader: ke,
755
- fragmentShader: je,
756
- blending: p.AdditiveBlending,
762
+ uniforms: _,
763
+ vertexShader: Ue,
764
+ fragmentShader: Ie,
765
+ blending: Oe,
757
766
  depthTest: !1,
758
767
  depthWrite: !1,
759
768
  transparent: !0,
760
769
  defines: {
761
- BILLBOARD_MODE: E === "billboard",
762
- MESH_MODE: E === "mesh",
770
+ BILLBOARD_MODE: p === "billboard",
771
+ MESH_MODE: p === "mesh",
763
772
  ALPHAMAP: !!l
764
773
  }
765
774
  }
766
775
  ),
767
- /* @__PURE__ */ R.jsx(
776
+ /* @__PURE__ */ b.jsx(
768
777
  "instancedBufferAttribute",
769
778
  {
770
779
  attach: "geometry-attributes-instanceColor",
771
780
  args: [x.instanceColor],
772
781
  itemSize: 3,
773
782
  count: r,
774
- usage: p.DynamicDrawUsage
783
+ usage: W
775
784
  }
776
785
  ),
777
- /* @__PURE__ */ R.jsx(
786
+ /* @__PURE__ */ b.jsx(
778
787
  "instancedBufferAttribute",
779
788
  {
780
789
  attach: "geometry-attributes-instanceColorEnd",
781
790
  args: [x.instanceColorEnd],
782
791
  itemSize: 3,
783
792
  count: r,
784
- usage: p.DynamicDrawUsage
793
+ usage: W
785
794
  }
786
795
  ),
787
- /* @__PURE__ */ R.jsx(
796
+ /* @__PURE__ */ b.jsx(
788
797
  "instancedBufferAttribute",
789
798
  {
790
799
  attach: "geometry-attributes-instanceDirection",
791
800
  args: [x.instanceDirection],
792
801
  itemSize: 3,
793
802
  count: r,
794
- usage: p.DynamicDrawUsage
803
+ usage: W
795
804
  }
796
805
  ),
797
- /* @__PURE__ */ R.jsx(
806
+ /* @__PURE__ */ b.jsx(
798
807
  "instancedBufferAttribute",
799
808
  {
800
809
  attach: "geometry-attributes-instanceLifetime",
801
810
  args: [x.instanceLifetime],
802
811
  itemSize: 2,
803
812
  count: r,
804
- usage: p.DynamicDrawUsage
813
+ usage: W
805
814
  }
806
815
  ),
807
- /* @__PURE__ */ R.jsx(
816
+ /* @__PURE__ */ b.jsx(
808
817
  "instancedBufferAttribute",
809
818
  {
810
819
  attach: "geometry-attributes-instanceSpeed",
811
820
  args: [x.instanceSpeed],
812
821
  itemSize: 1,
813
822
  count: r,
814
- usage: p.DynamicDrawUsage
823
+ usage: W
815
824
  }
816
825
  ),
817
- /* @__PURE__ */ R.jsx(
826
+ /* @__PURE__ */ b.jsx(
818
827
  "instancedBufferAttribute",
819
828
  {
820
829
  attach: "geometry-attributes-instanceRotationSpeed",
821
830
  args: [x.instanceRotationSpeed],
822
831
  itemSize: 3,
823
832
  count: r,
824
- usage: p.DynamicDrawUsage
833
+ usage: W
825
834
  }
826
835
  )
827
836
  ]
828
837
  }
829
- );
838
+ ) });
830
839
  };
831
840
  export {
832
- Le as VFXEmitter,
833
- Ie as VFXParticles
841
+ Xe as VFXEmitter,
842
+ Ge as VFXParticles
834
843
  };
@@ -1,4 +1,4 @@
1
- (function(x,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react"),require("zustand"),require("@react-three/fiber"),require("three"),require("leva")):typeof define=="function"&&define.amd?define(["exports","react","zustand","@react-three/fiber","three","leva"],u):(x=typeof globalThis<"u"?globalThis:x||self,u(x.LazyVFX={},x.React,x.zustand,x.Fiber,x.THREE,x.leva))})(this,(function(x,u,ge,ie,Ee,C){"use strict";function be(n){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const a in n)if(a!=="default"){const o=Object.getOwnPropertyDescriptor(n,a);Object.defineProperty(d,a,o.get?o:{enumerable:!0,get:()=>n[a]})}}return d.default=n,Object.freeze(d)}const v=be(Ee);var q={exports:{}},G={};/**
1
+ (function(y,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react"),require("@react-three/fiber"),require("three"),require("leva"),require("zustand")):typeof define=="function"&&define.amd?define(["exports","react","@react-three/fiber","three","leva","zustand"],c):(y=typeof globalThis<"u"?globalThis:y||self,c(y.LazyVFX={},y.React,y.Fiber,y.THREE,y.leva,y.zustand))})(this,(function(y,c,ie,m,O,ge){"use strict";var q={exports:{}},H={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var se;function Se(){if(se)return G;se=1;var n=Symbol.for("react.transitional.element"),d=Symbol.for("react.fragment");function a(o,r,i){var S=null;if(i!==void 0&&(S=""+i),r.key!==void 0&&(S=""+r.key),"key"in r){i={};for(var l in r)l!=="key"&&(i[l]=r[l])}else i=r;return r=i.ref,{$$typeof:n,type:o,key:S,ref:r!==void 0?r:null,props:i}}return G.Fragment=d,G.jsx=a,G.jsxs=a,G}var H={};/**
9
+ */var se;function Ee(){if(se)return H;se=1;var o=Symbol.for("react.transitional.element"),g=Symbol.for("react.fragment");function u(a,r,i){var b=null;if(i!==void 0&&(b=""+i),r.key!==void 0&&(b=""+r.key),"key"in r){i={};for(var l in r)l!=="key"&&(i[l]=r[l])}else i=r;return r=i.ref,{$$typeof:o,type:a,key:b,ref:r!==void 0?r:null,props:i}}return H.Fragment=g,H.jsx=u,H.jsxs=u,H}var Q={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,12 +14,12 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var ce;function ye(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&(function(){function n(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===D?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case L:return"Profiler";case N:return"StrictMode";case m:return"Suspense";case J:return"SuspenseList";case k:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case w:return"Portal";case T:return e.displayName||"Context";case I:return(e._context.displayName||"Context")+".Consumer";case y:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Q:return t=e.displayName||null,t!==null?t:n(e.type)||"Memo";case A:t=e._payload,e=e._init;try{return n(e(t))}catch{}}return null}function d(e){return""+e}function a(e){try{d(e);var t=!1}catch{t=!0}if(t){t=console;var f=t.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return f.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",g),d(e)}}function o(e){if(e===M)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===A)return"<...>";try{var t=n(e);return t?"<"+t+">":"<...>"}catch{return"<...>"}}function r(){var e=U.A;return e===null?null:e.getOwner()}function i(){return Error("react-stack-top-frame")}function S(e){if(V.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function l(e,t){function f(){B||(B=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}f.isReactWarning=!0,Object.defineProperty(e,"key",{get:f,configurable:!0})}function j(){var e=n(this.type);return Z[e]||(Z[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function _(e,t,f,g,te,oe){var E=f.ref;return e={$$typeof:P,type:e,key:t,props:f,_owner:g},(E!==void 0?E:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:j}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:oe}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function p(e,t,f,g,te,oe){var E=t.children;if(E!==void 0)if(g)if(Y(E)){for(g=0;g<E.length;g++)s(E[g]);Object.freeze&&Object.freeze(E)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else s(E);if(V.call(t,"key")){E=n(e);var W=Object.keys(t).filter(function(Te){return Te!=="key"});g=0<W.length?"{key: someKey, "+W.join(": ..., ")+": ...}":"{key: someKey}",z[E+g]||(W=0<W.length?"{"+W.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var ce;function be(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&(function(){function o(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case h:return"Fragment";case L:return"Profiler";case P:return"StrictMode";case d:return"Suspense";case B:return"SuspenseList";case C:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case M:return"Portal";case T:return e.displayName||"Context";case I:return(e._context.displayName||"Context")+".Consumer";case x:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case W:return t=e.displayName||null,t!==null?t:o(e.type)||"Memo";case A:t=e._payload,e=e._init;try{return o(e(t))}catch{}}return null}function g(e){return""+e}function u(e){try{g(e);var t=!1}catch{t=!0}if(t){t=console;var f=t.error,v=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return f.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",v),g(e)}}function a(e){if(e===h)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===A)return"<...>";try{var t=o(e);return t?"<"+t+">":"<...>"}catch{return"<...>"}}function r(){var e=D.A;return e===null?null:e.getOwner()}function i(){return Error("react-stack-top-frame")}function b(e){if(V.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function l(e,t){function f(){G||(G=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}f.isReactWarning=!0,Object.defineProperty(e,"key",{get:f,configurable:!0})}function F(){var e=o(this.type);return Z[e]||(Z[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function _(e,t,f,v,te,oe){var p=f.ref;return e={$$typeof:R,type:e,key:t,props:f,_owner:v},(p!==void 0?p:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:F}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:oe}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function n(e,t,f,v,te,oe){var p=t.children;if(p!==void 0)if(v)if(Y(p)){for(v=0;v<p.length;v++)w(p[v]);Object.freeze&&Object.freeze(p)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(p);if(V.call(t,"key")){p=o(e);var J=Object.keys(t).filter(function(Me){return Me!=="key"});v=0<J.length?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}",U[p+v]||(J=0<J.length?"{"+J.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,g,E,W,E),z[E+g]=!0)}if(E=null,f!==void 0&&(a(f),E=""+f),S(t)&&(a(t.key),E=""+t.key),"key"in t){f={};for(var ae in t)ae!=="key"&&(f[ae]=t[ae])}else f=t;return E&&l(f,typeof e=="function"?e.displayName||e.name||"Unknown":e),_(e,E,f,r(),te,oe)}function s(e){h(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===A&&(e._payload.status==="fulfilled"?h(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function h(e){return typeof e=="object"&&e!==null&&e.$$typeof===P}var c=u,P=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),T=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),k=Symbol.for("react.activity"),D=Symbol.for("react.client.reference"),U=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=Object.prototype.hasOwnProperty,Y=Array.isArray,X=console.createTask?console.createTask:function(){return null};c={react_stack_bottom_frame:function(e){return e()}};var B,Z={},F=c.react_stack_bottom_frame.bind(c,i)(),K=X(o(i)),z={};H.Fragment=M,H.jsx=function(e,t,f){var g=1e4>U.recentlyCreatedOwnerStacks++;return p(e,t,f,!1,g?Error("react-stack-top-frame"):F,g?X(o(e)):K)},H.jsxs=function(e,t,f){var g=1e4>U.recentlyCreatedOwnerStacks++;return p(e,t,f,!0,g?Error("react-stack-top-frame"):F,g?X(o(e)):K)}})()),H}var le;function xe(){return le||(le=1,process.env.NODE_ENV==="production"?q.exports=Se():q.exports=ye()),q.exports}var R=xe();const re=ge.create((n,d)=>({emitters:{},registerEmitter:(a,o)=>{if(d().emitters[a]){console.warn(`Emitter ${a} already exists`);return}n(r=>(r.emitters[a]=o,r))},unregisterEmitter:a=>{n(o=>(delete o.emitters[a],o))},emit:(a,...o)=>{const r=d().emitters[a];if(!r){console.warn(`Emitter ${a} not found`);return}r(...o)}}));function ue(n,d){return n+Math.floor(Math.random()*(d-n+1))}function b(n,d){return n+Math.random()*(d-n)}const Re=({settings:n,onChange:d,onRestart:a})=>{C.useControls("⚙️ Emitter Settings",{Restart:C.button(()=>a()),Export:C.button(()=>{const l=JSON.stringify(S.current);console.log("📋 Values saved to clipboard: ",l),navigator.clipboard.writeText(l)})});const[{...o},r]=C.useControls(()=>({"🪄 Emitter":C.folder({duration:4,delay:0,nbParticles:2e3,spawnMode:{options:["time","burst"],value:"time"},loop:!1,startPositionMin:{value:[-1,-1,-1],min:-10,max:10,step:.1,label:"startPositionMin"},startPositionMax:{value:[1,1,1],min:-10,max:10,step:.1,label:"startPositionMax"},startRotationMin:{value:[0,0,0],min:-Math.PI*2,max:Math.PI*2,step:.1,label:"startRotationMin"},startRotationMax:{value:[0,0,0],min:-Math.PI*2,max:Math.PI*2,step:.1,label:"startRotationMax"}}),"✨ Particles":C.folder({particlesLifetime:{value:[.1,1],min:0,max:10,step:.1,label:"lifetime"}}),"🌪 Forces":C.folder({speed:{value:[5,20],min:-100,max:100},directionMin:{value:[-1,-1,-1],min:-1,max:1,step:.1},directionMax:{value:[1,1,1],min:-1,max:1,step:.1},rotationSpeedMin:{value:[0,0,0],min:0,max:10,step:.1},rotationSpeedMax:{value:[0,0,0],min:0,max:10,step:.1}}),"🎨 Appearance":C.folder({nbColors:{options:[1,2,3]},colorStart:"#ffffff",colorEnd:"#ffffff",colorStart2:{value:"#ff0000",render:l=>l("🎨 Appearance.nbColors")>1},colorEnd2:{value:"#ffffff",render:l=>l("🎨 Appearance.nbColors")>1},colorStart3:{value:"#ff0000",render:l=>l("🎨 Appearance.nbColors")>2},colorEnd3:{value:"#ff0000",render:l=>l("🎨 Appearance.nbColors")>2},size:{value:[.01,1],min:0,max:5,step:.01,label:"size"}})})),i={...o,colorStart:[o.colorStart],colorEnd:[o.colorEnd]};delete i.nbColors,delete i.colorStart2,delete i.colorEnd2,delete i.colorStart3,delete i.colorEnd3,o.nbColors>1&&i.colorStart.push(o.colorStart2),o.nbColors>1&&i.colorEnd.push(o.colorEnd2),o.nbColors>2&&i.colorStart.push(o.colorStart3),o.nbColors>2&&i.colorEnd.push(o.colorEnd3);const S=u.useRef(i);S.current=i,u.useEffect(()=>{var l,j;if(n){const _={...n};for(let p=0;p<2;p++)((l=n.colorStart)==null?void 0:l.length)>p&&(_[p===0?"colorStart":`colorStart${p+1}`]=n.colorStart[p],_.nbColors=p+1),((j=n.colorEnd)==null?void 0:j.length)>p&&(_[p===0?"colorEnd":`colorEnd${p+1}`]=n.colorEnd[p]);r({..._})}},[n]),d(i)},$=new v.Vector3,ne=new v.Quaternion,he=new v.Euler,ee=new v.Euler,Pe=new v.Vector3,_e=u.forwardRef(({debug:n=!1,emitter:d,settings:a={},...o},r)=>{const[{duration:i=1,nParticles:S=1e3,spawnMode:l="time",loop:j=!1,delay:_=0,colorStart:p=["white","skyblue"],colorEnd:s=[],particlesLifetime:h=[.1,1],speed:c=[5,20],size:P=[.1,1],startPositionMin:w=[-1,-1,-1],startPositionMax:M=[1,1,1],startRotationMin:N=[0,0,0],startRotationMax:L=[0,0,0],rotationSpeedMin:I=[0,0,0],rotationSpeedMax:T=[0,0,0],directionMin:y=[0,0,0],directionMax:m=[0,0,0]},J]=u.useState(a),Q=re(Y=>Y.emit),A=u.useRef();u.useImperativeHandle(r,()=>A.current);const k=u.useRef(0),D=u.useRef(0);ie.useFrame(({clock:Y},X)=>{const B=Y.elapsedTime;if(D.current<S||j){if(!A)return;const F=(l==="burst"?S:Math.max(0,Math.floor((k.current-_)/i*S)))-D.current;F>0&&k.current>=_&&(Q(d,F,()=>{A.current.updateWorldMatrix(!0),A.current.matrixWorld.decompose($,ne,Pe),he.setFromQuaternion(ne),ee.setFromQuaternion(ne);const z=b(P[0],P[1]),e=p[ue(0,p.length-1)];return{position:[$.x+b(w[0],M[0]),$.y+b(w[1],M[1]),$.z+b(w[2],M[2])],direction:[b(y[0],m[0]),b(y[1],m[1]),b(y[2],m[2])],scale:[z,z,z],rotation:[ee.x+b(N[0],L[0]),ee.y+b(N[1],L[1]),ee.z+b(N[2],L[2])],rotationSpeed:[b(I[0],T[0]),b(I[1],T[1]),b(I[2],T[2])],lifetime:[B,b(h[0],h[1])],colorStart:e,colorEnd:s!=null&&s.length?s[ue(0,s.length-1)]:e,speed:[b(c[0],c[1])]}}),D.current+=F)}k.current+=X});const U=u.useCallback(()=>{D.current=0,k.current=0},[]),V=u.useMemo(()=>n?R.jsx(Re,{settings:a,onChange:J,onRestart:U}):null,[n]);return R.jsxs(R.Fragment,{children:[V,R.jsx("object3D",{...o,ref:A})]})});var Ae=`varying vec2 vUv;
22
+ <%s key={someKey} {...props} />`,v,p,J,p),U[p+v]=!0)}if(p=null,f!==void 0&&(u(f),p=""+f),b(t)&&(u(t.key),p=""+t.key),"key"in t){f={};for(var ae in t)ae!=="key"&&(f[ae]=t[ae])}else f=t;return p&&l(f,typeof e=="function"?e.displayName||e.name||"Unknown":e),_(e,p,f,r(),te,oe)}function w(e){N(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===A&&(e._payload.status==="fulfilled"?N(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function N(e){return typeof e=="object"&&e!==null&&e.$$typeof===R}var s=c,R=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),T=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),j=Symbol.for("react.client.reference"),D=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=Object.prototype.hasOwnProperty,Y=Array.isArray,X=console.createTask?console.createTask:function(){return null};s={react_stack_bottom_frame:function(e){return e()}};var G,Z={},z=s.react_stack_bottom_frame.bind(s,i)(),K=X(a(i)),U={};Q.Fragment=h,Q.jsx=function(e,t,f){var v=1e4>D.recentlyCreatedOwnerStacks++;return n(e,t,f,!1,v?Error("react-stack-top-frame"):z,v?X(a(e)):K)},Q.jsxs=function(e,t,f){var v=1e4>D.recentlyCreatedOwnerStacks++;return n(e,t,f,!0,v?Error("react-stack-top-frame"):z,v?X(a(e)):K)}})()),Q}var le;function Se(){return le||(le=1,process.env.NODE_ENV==="production"?q.exports=Ee():q.exports=be()),q.exports}var S=Se();function ue(o,g){return o+Math.floor(Math.random()*(g-o+1))}function E(o,g){return o+Math.random()*(g-o)}const xe=({settings:o,onChange:g,onRestart:u})=>{O.useControls("⚙️ Emitter Settings",{Restart:O.button(()=>u()),Export:O.button(()=>{const l=JSON.stringify(b.current);console.log("📋 Values saved to clipboard: ",l),navigator.clipboard.writeText(l)})});const[{...a},r]=O.useControls(()=>({"🪄 Emitter":O.folder({duration:4,delay:0,nbParticles:2e3,spawnMode:{options:["time","burst"],value:"time"},loop:!1,startPositionMin:{value:[-1,-1,-1],min:-10,max:10,step:.1,label:"startPositionMin"},startPositionMax:{value:[1,1,1],min:-10,max:10,step:.1,label:"startPositionMax"},startRotationMin:{value:[0,0,0],min:-Math.PI*2,max:Math.PI*2,step:.1,label:"startRotationMin"},startRotationMax:{value:[0,0,0],min:-Math.PI*2,max:Math.PI*2,step:.1,label:"startRotationMax"}}),"✨ Particles":O.folder({particlesLifetime:{value:[.1,1],min:0,max:10,step:.1,label:"lifetime"}}),"🌪 Forces":O.folder({speed:{value:[5,20],min:-100,max:100},directionMin:{value:[-1,-1,-1],min:-1,max:1,step:.1},directionMax:{value:[1,1,1],min:-1,max:1,step:.1},rotationSpeedMin:{value:[0,0,0],min:0,max:10,step:.1},rotationSpeedMax:{value:[0,0,0],min:0,max:10,step:.1}}),"🎨 Appearance":O.folder({nbColors:{options:[1,2,3]},colorStart:"#ffffff",colorEnd:"#ffffff",colorStart2:{value:"#ff0000",render:l=>l("🎨 Appearance.nbColors")>1},colorEnd2:{value:"#ffffff",render:l=>l("🎨 Appearance.nbColors")>1},colorStart3:{value:"#ff0000",render:l=>l("🎨 Appearance.nbColors")>2},colorEnd3:{value:"#ff0000",render:l=>l("🎨 Appearance.nbColors")>2},size:{value:[.01,1],min:0,max:5,step:.01,label:"size"}})})),i={...a,colorStart:[a.colorStart],colorEnd:[a.colorEnd]};delete i.nbColors,delete i.colorStart2,delete i.colorEnd2,delete i.colorStart3,delete i.colorEnd3,a.nbColors>1&&i.colorStart.push(a.colorStart2),a.nbColors>1&&i.colorEnd.push(a.colorEnd2),a.nbColors>2&&i.colorStart.push(a.colorStart3),a.nbColors>2&&i.colorEnd.push(a.colorEnd3);const b=c.useRef(i);b.current=i,c.useEffect(()=>{var l,F;if(o){const _={...o};for(let n=0;n<2;n++)((l=o.colorStart)==null?void 0:l.length)>n&&(_[n===0?"colorStart":`colorStart${n+1}`]=o.colorStart[n],_.nbColors=n+1),((F=o.colorEnd)==null?void 0:F.length)>n&&(_[n===0?"colorEnd":`colorEnd${n+1}`]=o.colorEnd[n]);r({..._})}},[o]),g(i)},re=ge.create((o,g)=>({emitters:{},registerEmitter:(u,a)=>{if(g().emitters[u]){console.warn(`Emitter ${u} already exists`);return}o(r=>(r.emitters[u]=a,r))},unregisterEmitter:u=>{o(a=>(delete a.emitters[u],a))},emit:(u,...a)=>{const r=g().emitters[u];if(!r){console.warn(`Emitter ${u} not found`);return}r(...a)}})),$=new m.Vector3,ne=new m.Quaternion,ye=new m.Euler,ee=new m.Euler,Re=new m.Vector3,Pe=c.forwardRef(({debug:o,emitter:g,settings:u={},...a},r)=>{const[{duration:i=1,nbParticles:b=1e3,spawnMode:l="time",loop:F=!1,delay:_=0,colorStart:n=["white","skyblue"],colorEnd:w=[],particlesLifetime:N=[.1,1],speed:s=[5,20],size:R=[.1,1],startPositionMin:M=[-1,-1,-1],startPositionMax:h=[1,1,1],startRotationMin:P=[0,0,0],startRotationMax:L=[0,0,0],rotationSpeedMin:I=[0,0,0],rotationSpeedMax:T=[0,0,0],directionMin:x=[0,0,0],directionMax:d=[0,0,0]},B]=c.useState(u),W=re(Y=>Y.emit),A=c.useRef();c.useImperativeHandle(r,()=>A.current);const C=c.useRef(0),j=c.useRef(0);ie.useFrame(({clock:Y},X)=>{const G=Y.getElapsedTime();if(C.current<b||F){if(!A)return;const z=(l==="burst"?b:Math.max(0,Math.floor((j.current-_)/i*b)))-C.current;z>0&&j.current>=_&&(W(g,z,()=>{A.current.updateWorldMatrix(!0),A.current.matrixWorld.decompose($,ne,Re),ye.setFromQuaternion(ne),ee.setFromQuaternion(ne);const U=E(R[0],R[1]),e=n[ue(0,n.length-1)];return{position:[$.x+E(M[0],h[0]),$.y+E(M[1],h[1]),$.z+E(M[2],h[2])],direction:[E(x[0],d[0]),E(x[1],d[1]),E(x[2],d[2])],scale:[U,U,U],rotation:[ee.x+E(P[0],L[0]),ee.y+E(P[1],L[1]),ee.z+E(P[2],L[2])],rotationSpeed:[E(I[0],T[0]),E(I[1],T[1]),E(I[2],T[2])],lifetime:[G,E(N[0],N[1])],colorStart:e,colorEnd:w!=null&&w.length?w[ue(0,w.length-1)]:e,speed:[E(s[0],s[1])]}}),C.current+=z)}j.current+=X});const D=c.useCallback(()=>{C.current=0,j.current=0},[]),V=c.useMemo(()=>o?S.jsx(xe,{settings:u,onChange:B,onRestart:D}):null,[o]);return S.jsxs(S.Fragment,{children:[V,S.jsx("object3D",{...a,ref:A})]})});var Ae=`varying vec2 vUv;
23
23
  varying vec3 vColor;
24
24
  varying vec3 vColorEnd;
25
25
  varying float vProgress;
@@ -124,7 +124,7 @@ React keys must be passed directly to JSX without using spread:
124
124
  vUv = uv;
125
125
  vColor = instanceColor;
126
126
  vColorEnd = instanceColorEnd;
127
- }`,we=`varying vec2 vUv;
127
+ }`,_e=`varying vec2 vUv;
128
128
  varying vec3 vColor;
129
129
  varying vec3 vColorEnd;
130
130
  varying float vProgress;
@@ -149,4 +149,4 @@ React keys must be passed directly to JSX without using spread:
149
149
  #else
150
150
  gl_FragColor = vec4(color, alpha);
151
151
  #endif
152
- }`;const fe=new v.Vector3,de=new v.Euler,me=new v.Quaternion,ve=new v.Vector3(1,1,1),pe=new v.Matrix4,O=new v.Color,Me=({name:n,settings:d={},alphaMap:a,geometry:o})=>{const{nParticals:r=1e3,intensity:i=1,renderMode:S="mesh",fadeSize:l=[.1,.9],fadeAlpha:j=[0,1],gravity:_=[0,0,0]}=d,p=new v.PlaneGeometry,s=u.useRef(),[h]=u.useState({instanceColor:new Float32Array(r*3),instanceColorEnd:new Float32Array(r*3),instanceDirection:new Float32Array(r*3),instanceLifetime:new Float32Array(r*2),instanceSpeed:new Float32Array(r*1),instanceRotationSpeed:new Float32Array(r*3)}),c=u.useRef(0),P=u.useRef(0),w=u.useRef(!1),M=(y,m)=>{const J=s.current.geometry.getAttribute("instanceColor"),Q=s.current.geometry.getAttribute("instanceColorEnd"),A=s.current.geometry.getAttribute("instanceDirection"),k=s.current.geometry.getAttribute("instanceLifetime"),D=s.current.geometry.getAttribute("instanceSpeed"),U=s.current.geometry.getAttribute("instanceRotationSpeed");for(let V=0;V<y;V++){c.current>=r&&(c.current=0);const{scale:Y,rotation:X,rotationSpeed:B,position:Z,direction:F,lifetime:K,colorStart:z,colorEnd:e,speed:t}=m();fe.set(...Z),de.set(...X),me.setFromEuler(de),ve.set(...Y),pe.compose(fe,me,ve),O.set(z),O.set(e),A.set(F,c.current*3),k.set(K,c.current*2),D.set([t],c.current),U.set(B,c.current*3),J.set([O.r,O.g,O.b],c.current*3),Q.set([O.r,O.g,O.b],c.current*3),s.current.setMatrixAt(c.current,pe)}w.current=!0,c.current++,c.current=c.current%r},N=()=>{if(!w.current||!s.current)return;[s.current.instanceMatrix,s.current.geometry.getAttribute("instanceColor"),s.current.geometry.getAttribute("instanceColorEnd"),s.current.geometry.getAttribute("instanceDirection"),s.current.geometry.getAttribute("instanceLifetime"),s.current.geometry.getAttribute("instanceSpeed"),s.current.geometry.getAttribute("instanceRotationSpeed")].forEach(m=>{m.clearUpdateRanges(),P.current>c.current?(m.addUpdateRange(0,c.current*m.itemSize),m.addUpdateRange(P.current*m.itemSize,r*m.itemSize-P.current*m.itemSize)):m.addUpdateRange(P.current*m.itemSize,c.current*m.itemSize-P.current*m.itemSize),m.needsUpdate=!0}),P.current=c.current,w.current=!1},L=re(y=>y.registerEmitter),I=re(y=>y.unregisterEmitter);u.useEffect(()=>(L(n,M),()=>{I(n)}),[]);const T=u.useMemo(()=>({uTime:{value:0},uIntensity:{value:i},uFadeSize:{value:l},uFadeAlpha:{value:j},uGravity:{value:_},uAlphaMap:{value:a}}),[]);return ie.useFrame(({clock:y})=>{T&&(T.uTime.value=y.elapsedTime)}),R.jsxs("instancedMesh",{ref:s,args:[p,null,r],onBeforeRender:N,children:[o,R.jsx("shaderMaterial",{uniforms:T,vertexShader:Ae,fragmentShader:we,blending:v.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0,defines:{BILLBOARD_MODE:S==="billboard",MESH_MODE:S==="mesh",ALPHAMAP:!!a}}),R.jsx("instancedBufferAttribute",{attach:"geometry-attributes-instanceColor",args:[h.instanceColor],itemSize:3,count:r,usage:v.DynamicDrawUsage}),R.jsx("instancedBufferAttribute",{attach:"geometry-attributes-instanceColorEnd",args:[h.instanceColorEnd],itemSize:3,count:r,usage:v.DynamicDrawUsage}),R.jsx("instancedBufferAttribute",{attach:"geometry-attributes-instanceDirection",args:[h.instanceDirection],itemSize:3,count:r,usage:v.DynamicDrawUsage}),R.jsx("instancedBufferAttribute",{attach:"geometry-attributes-instanceLifetime",args:[h.instanceLifetime],itemSize:2,count:r,usage:v.DynamicDrawUsage}),R.jsx("instancedBufferAttribute",{attach:"geometry-attributes-instanceSpeed",args:[h.instanceSpeed],itemSize:1,count:r,usage:v.DynamicDrawUsage}),R.jsx("instancedBufferAttribute",{attach:"geometry-attributes-instanceRotationSpeed",args:[h.instanceRotationSpeed],itemSize:3,count:r,usage:v.DynamicDrawUsage})]})};x.VFXEmitter=_e,x.VFXParticles=Me,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})}));
152
+ }`;const fe=new m.Vector3,de=new m.Euler,me=new m.Quaternion,ve=new m.Vector3(1,1,1),pe=new m.Matrix4,k=new m.Color,we=({name:o,settings:g={},alphaMap:u,geometry:a})=>{const{nbParticles:r=1e3,intensity:i=1,renderMode:b="mesh",fadeSize:l=[.1,.9],fadeAlpha:F=[0,1],gravity:_=[0,0,0]}=g,n=c.useRef(),w=c.useMemo(()=>new m.PlaneGeometry(.5,.5),[]),N=()=>{if(!M.current||!n.current)return;[n.current.instanceMatrix,n.current.geometry.getAttribute("instanceColor"),n.current.geometry.getAttribute("instanceColorEnd"),n.current.geometry.getAttribute("instanceDirection"),n.current.geometry.getAttribute("instanceLifetime"),n.current.geometry.getAttribute("instanceSpeed"),n.current.geometry.getAttribute("instanceRotationSpeed")].forEach(d=>{d.clearUpdateRanges(),R.current>s.current?(d.addUpdateRange(0,s.current*d.itemSize),d.addUpdateRange(R.current*d.itemSize,r*d.itemSize-R.current*d.itemSize)):d.addUpdateRange(R.current*d.itemSize,s.current*d.itemSize-R.current*d.itemSize),d.needsUpdate=!0}),R.current=s.current,M.current=!1},s=c.useRef(0),R=c.useRef(0),M=c.useRef(!1),h=(x,d)=>{const B=n.current.geometry.getAttribute("instanceColor"),W=n.current.geometry.getAttribute("instanceColorEnd"),A=n.current.geometry.getAttribute("instanceDirection"),C=n.current.geometry.getAttribute("instanceLifetime"),j=n.current.geometry.getAttribute("instanceSpeed"),D=n.current.geometry.getAttribute("instanceRotationSpeed");for(let V=0;V<x;V++){s.current>=r&&(s.current=0);const{scale:Y,rotation:X,rotationSpeed:G,position:Z,direction:z,lifetime:K,colorStart:U,colorEnd:e,speed:t}=d();fe.set(...Z),de.set(...X),me.setFromEuler(de),ve.set(...Y),pe.compose(fe,me,ve),n.current.setMatrixAt(s.current,pe),k.set(U),B.set([k.r,k.g,k.b],s.current*3),k.set(e),W.set([k.r,k.g,k.b],s.current*3),A.set(z,s.current*3),C.set(K,s.current*2),j.set([t],s.current),D.set(G,s.current*3),s.current++,s.current=s.current%r}n.current.instanceMatrix.needsUpdate=!0,B.needsUpdate=!0,W.needsUpdate=!0,A.needsUpdate=!0,C.needsUpdate=!0,j.needsUpdate=!0,D.needsUpdate=!0,M.current=!0},[P]=c.useState({instanceColor:new Float32Array(r*3),instanceColorEnd:new Float32Array(r*3),instanceDirection:new Float32Array(r*3),instanceLifetime:new Float32Array(r*2),instanceSpeed:new Float32Array(r*1),instanceRotationSpeed:new Float32Array(r*3)}),L=re(x=>x.registerEmitter),I=re(x=>x.unregisterEmitter);c.useEffect(()=>(L(o,h),()=>{I(o)}),[]);const T=c.useMemo(()=>({uTime:{value:0},uIntensity:{value:i},uFadeSize:{value:l},uFadeAlpha:{value:F},uGravity:{value:_},uAlphaMap:{value:u}}),[]);return ie.useFrame(({clock:x})=>{T&&(T.uTime.value=x.elapsedTime)}),S.jsx(S.Fragment,{children:S.jsxs("instancedMesh",{args:[w,null,r],ref:n,onBeforeRender:N,children:[a,S.jsx("shaderMaterial",{uniforms:T,vertexShader:Ae,fragmentShader:_e,blending:m.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0,defines:{BILLBOARD_MODE:b==="billboard",MESH_MODE:b==="mesh",ALPHAMAP:!!u}}),S.jsx("instancedBufferAttribute",{attach:"geometry-attributes-instanceColor",args:[P.instanceColor],itemSize:3,count:r,usage:m.DynamicDrawUsage}),S.jsx("instancedBufferAttribute",{attach:"geometry-attributes-instanceColorEnd",args:[P.instanceColorEnd],itemSize:3,count:r,usage:m.DynamicDrawUsage}),S.jsx("instancedBufferAttribute",{attach:"geometry-attributes-instanceDirection",args:[P.instanceDirection],itemSize:3,count:r,usage:m.DynamicDrawUsage}),S.jsx("instancedBufferAttribute",{attach:"geometry-attributes-instanceLifetime",args:[P.instanceLifetime],itemSize:2,count:r,usage:m.DynamicDrawUsage}),S.jsx("instancedBufferAttribute",{attach:"geometry-attributes-instanceSpeed",args:[P.instanceSpeed],itemSize:1,count:r,usage:m.DynamicDrawUsage}),S.jsx("instancedBufferAttribute",{attach:"geometry-attributes-instanceRotationSpeed",args:[P.instanceRotationSpeed],itemSize:3,count:r,usage:m.DynamicDrawUsage})]})})};y.VFXEmitter=Pe,y.VFXParticles=we,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lazy-vfx",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Effortless high-end visual effects for React and Three.js",
5
5
  "keywords": [
6
6
  "react",
@@ -14,7 +14,7 @@
14
14
  "motion-design"
15
15
  ],
16
16
  "type": "module",
17
- "main": "./dist/lazy-vfx.umd.js",
17
+ "main": "./dist/lazy-vfx.umd.js",
18
18
  "module": "./dist/lazy-vfx.es.js",
19
19
  "exports": {
20
20
  ".": {
@@ -32,11 +32,11 @@
32
32
  "prepublishOnly": "pnpm build"
33
33
  },
34
34
  "peerDependencies": {
35
+ "@react-three/drei": ">=9.0.0",
36
+ "@react-three/fiber": ">=8.0.0",
35
37
  "react": ">=18.0.0",
36
38
  "react-dom": ">=18.0.0",
37
- "three": ">=0.150.0",
38
- "@react-three/fiber": ">=8.0.0",
39
- "@react-three/drei": ">=9.0.0"
39
+ "three": ">=0.150.0"
40
40
  },
41
41
  "dependencies": {
42
42
  "@react-three/postprocessing": "^3.0.4",
@@ -50,12 +50,18 @@
50
50
  "@types/react-dom": "^19.0.4",
51
51
  "@vitejs/plugin-react": "^4.3.4",
52
52
  "globals": "^15.15.0",
53
+ "path": "^0.12.7",
53
54
  "react": "^19.0.0",
54
55
  "react-dom": "^19.0.0",
55
- "three": "^0.183.2",
56
+ "three": "^0.160.0",
56
57
  "vite": "^6.2.0",
57
- "vite-plugin-glsl": "^1.5.6",
58
- "path": "^0.12.7"
58
+ "vite-plugin-glsl": "^1.5.6"
59
+ },
60
+ "overrides": {
61
+ "postprocessing": "6.36.7"
62
+ },
63
+ "resolutions": {
64
+ "postprocessing": "6.36.7"
59
65
  },
60
66
  "author": "Sameer Khan",
61
67
  "license": "MIT"