@minicode-dev/chat 0.1.4 → 0.1.5
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.
- package/assets/sounds/effects/confetti.mp3 +0 -0
- package/assets/sounds/effects/nudge.mp3 +0 -0
- package/dist/chunks/confettiScene3d-WooGwo25.js +367 -0
- package/dist/chunks/confettiScene3d-WooGwo25.js.map +1 -0
- package/dist/chunks/thunderScene3d-FMMuwJRP.js +218 -0
- package/dist/chunks/thunderScene3d-FMMuwJRP.js.map +1 -0
- package/dist/chunks/timeline-BLBedCYj.js +45 -0
- package/dist/chunks/timeline-BLBedCYj.js.map +1 -0
- package/dist/index.js +2365 -2089
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { AdditiveBlending as e, AmbientLight as t, BoxGeometry as n, BufferAttribute as r, BufferGeometry as i, CanvasTexture as a, CatmullRomCurve3 as o, Color as s, ConeGeometry as c, CylinderGeometry as l, DirectionalLight as u, DoubleSide as d, DynamicDrawUsage as f, ExtrudeGeometry as p, InstancedMesh as m, Mesh as ee, MeshLambertMaterial as te, MeshStandardMaterial as ne, Object3D as h, PerspectiveCamera as re, PlaneGeometry as ie, PointLight as g, Points as ae, PointsMaterial as oe, Scene as se, Shape as _, SphereGeometry as v, TorusGeometry as ce, TubeGeometry as y, Vector3 as b, WebGLRenderer as x } from "three";
|
|
2
|
+
// src/effects/confetti/confettiScene3d.js
|
|
3
|
+
var S = [
|
|
4
|
+
"#ff4d8d",
|
|
5
|
+
"#ffd23f",
|
|
6
|
+
"#3ddc97",
|
|
7
|
+
"#4cc9f0",
|
|
8
|
+
"#9b5de5",
|
|
9
|
+
"#ff7b29",
|
|
10
|
+
"#f15bb5",
|
|
11
|
+
"#ffffff"
|
|
12
|
+
].map((e) => new s(e)), C = 12, w = (e, t) => e + Math.random() * (t - e), T = (e) => e[Math.floor(Math.random() * e.length)], E = () => typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches || (navigator.hardwareConcurrency || 8) <= 4;
|
|
13
|
+
function le(e = 64) {
|
|
14
|
+
let t = document.createElement("canvas");
|
|
15
|
+
t.width = e, t.height = e;
|
|
16
|
+
let n = t.getContext("2d"), r = n.createRadialGradient(e / 2, e / 2, 0, e / 2, e / 2, e / 2);
|
|
17
|
+
return r.addColorStop(0, "rgba(255,255,255,1)"), r.addColorStop(.35, "rgba(255,255,255,.6)"), r.addColorStop(1, "rgba(255,255,255,0)"), n.fillStyle = r, n.fillRect(0, 0, e, e), new a(t);
|
|
18
|
+
}
|
|
19
|
+
function ue() {
|
|
20
|
+
let e = new _();
|
|
21
|
+
for (let t = 0; t < 10; t += 1) {
|
|
22
|
+
let n = t % 2 ? .14 : .32, r = t / 10 * Math.PI * 2 + Math.PI / 2, i = Math.cos(r) * n, a = Math.sin(r) * n;
|
|
23
|
+
t ? e.lineTo(i, a) : e.moveTo(i, a);
|
|
24
|
+
}
|
|
25
|
+
let t = new p(e, {
|
|
26
|
+
depth: .08,
|
|
27
|
+
bevelEnabled: !0,
|
|
28
|
+
bevelThickness: .03,
|
|
29
|
+
bevelSize: .02,
|
|
30
|
+
bevelSegments: 1
|
|
31
|
+
});
|
|
32
|
+
return t.center(), t;
|
|
33
|
+
}
|
|
34
|
+
function de(e) {
|
|
35
|
+
let t = [], n = w(2.5, 4);
|
|
36
|
+
for (let e = 0; e <= 24; e += 1) {
|
|
37
|
+
let r = e / 24, i = r * n * Math.PI * 2;
|
|
38
|
+
t.push(new b(Math.cos(i) * .18, r * 2.2 - 1.1, Math.sin(i) * .18));
|
|
39
|
+
}
|
|
40
|
+
return new y(new o(t), e ? 60 : 110, .022, e ? 3 : 4, !1);
|
|
41
|
+
}
|
|
42
|
+
function D(e, t, n, r) {
|
|
43
|
+
let i = new h(), a = t.map(({ geometry: t, material: r, tinted: a }) => {
|
|
44
|
+
let o = new m(t, r, n);
|
|
45
|
+
if (o.instanceMatrix.setUsage(f), o.frustumCulled = !1, a) {
|
|
46
|
+
for (let e = 0; e < n; e += 1) o.setColorAt(e, S[0]);
|
|
47
|
+
o.instanceColor.setUsage(f);
|
|
48
|
+
}
|
|
49
|
+
i.scale.setScalar(0), i.updateMatrix();
|
|
50
|
+
for (let e = 0; e < n; e += 1) o.setMatrixAt(e, i.matrix);
|
|
51
|
+
return e.add(o), {
|
|
52
|
+
mesh: o,
|
|
53
|
+
tinted: a
|
|
54
|
+
};
|
|
55
|
+
}), o = Array.from({ length: n }, () => ({
|
|
56
|
+
alive: !1,
|
|
57
|
+
pos: new b(),
|
|
58
|
+
vel: new b(),
|
|
59
|
+
rot: new b(),
|
|
60
|
+
spin: new b(),
|
|
61
|
+
size: 1,
|
|
62
|
+
life: 0,
|
|
63
|
+
phase: 0
|
|
64
|
+
})), s = 0;
|
|
65
|
+
return {
|
|
66
|
+
spawn(e, t, i = 1, c = w(4, 6)) {
|
|
67
|
+
let l = s;
|
|
68
|
+
s = (s + 1) % n;
|
|
69
|
+
let u = o[l];
|
|
70
|
+
u.alive = !0, u.pos.copy(e), u.vel.copy(t), u.rot.set(w(0, 6.3), w(0, 6.3), w(0, 6.3)), u.spin.set(w(-1, 1), w(-1, 1), w(-1, 1)).multiplyScalar(r.spin), u.size = i, u.life = c, u.phase = w(0, 6.3);
|
|
71
|
+
let d = T(S);
|
|
72
|
+
a.forEach(({ mesh: e, tinted: t }) => {
|
|
73
|
+
t && (e.setColorAt(l, d), e.instanceColor.needsUpdate = !0);
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
update(e, t, s) {
|
|
77
|
+
let c = Math.max(0, 1 - r.drag * e);
|
|
78
|
+
for (let l = 0; l < n; l += 1) {
|
|
79
|
+
let n = o[l];
|
|
80
|
+
if (!n.alive) continue;
|
|
81
|
+
n.life -= e, n.vel.y += r.gravity * e, n.vel.multiplyScalar(c), n.pos.addScaledVector(n.vel, e), r.sway && (n.pos.x += Math.sin(t * r.swayRate + n.phase) * r.sway * e), n.rot.addScaledVector(n.spin, e);
|
|
82
|
+
let u = n.pos.y < -s.halfHeight - 2 || n.pos.y > s.halfHeight + 3;
|
|
83
|
+
(n.life <= 0 || u) && (n.alive = !1);
|
|
84
|
+
let d = n.alive ? n.size * Math.min(1, n.life / .4) : 0;
|
|
85
|
+
i.position.copy(n.pos), i.rotation.set(n.rot.x, n.rot.y, n.rot.z), i.scale.setScalar(d), i.updateMatrix();
|
|
86
|
+
for (let e = 0; e < a.length; e += 1) a[e].mesh.setMatrixAt(l, i.matrix);
|
|
87
|
+
}
|
|
88
|
+
a.forEach(({ mesh: e }) => {
|
|
89
|
+
e.instanceMatrix.needsUpdate = !0;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function O(e) {
|
|
95
|
+
let t = E(), n = new x({
|
|
96
|
+
canvas: e,
|
|
97
|
+
alpha: !0,
|
|
98
|
+
antialias: !t,
|
|
99
|
+
powerPreference: "high-performance"
|
|
100
|
+
});
|
|
101
|
+
try {
|
|
102
|
+
return k(n, t);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
throw n.dispose(), n.forceContextLoss?.(), e;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function k(a, o) {
|
|
108
|
+
a.setPixelRatio(Math.min(o ? 1.5 : 2, window.devicePixelRatio || 1)), a.setClearColor(0, 0);
|
|
109
|
+
let s = new se(), f = new re(50, 1, .1, 80);
|
|
110
|
+
f.position.set(0, 0, C);
|
|
111
|
+
let p = {
|
|
112
|
+
halfWidth: 6,
|
|
113
|
+
halfHeight: 5.6
|
|
114
|
+
}, m = o ? .5 : 1, h = new u(16777215, 1.1 * m);
|
|
115
|
+
h.position.set(2, 4, 6);
|
|
116
|
+
let _ = new g(16736168, 1.4 * m, 30, 1.5), y = new g(5032432, 1.4 * m, 30, 1.5), x = new g(16773570, 0, 40, 1.4);
|
|
117
|
+
x.position.set(0, .5, 4), s.add(new t(16777215, .55 * m), h, _, y, x);
|
|
118
|
+
let E = (e, t = {}) => o ? new te(e) : new ne({
|
|
119
|
+
roughness: .35,
|
|
120
|
+
metalness: .2,
|
|
121
|
+
...e,
|
|
122
|
+
...t
|
|
123
|
+
}), O = (e) => E({ color: 16777215 }, e), k = E({
|
|
124
|
+
color: 16764746,
|
|
125
|
+
emissive: 4861184
|
|
126
|
+
}, {
|
|
127
|
+
metalness: .75,
|
|
128
|
+
roughness: .25
|
|
129
|
+
}), A = o ? .5 : 1, j = D(s, [{
|
|
130
|
+
geometry: new ie(.14, .22),
|
|
131
|
+
material: E({
|
|
132
|
+
color: 16777215,
|
|
133
|
+
side: d
|
|
134
|
+
}, {
|
|
135
|
+
metalness: .35,
|
|
136
|
+
roughness: .4
|
|
137
|
+
}),
|
|
138
|
+
tinted: !0
|
|
139
|
+
}], Math.round(2400 * A), {
|
|
140
|
+
gravity: -3.2,
|
|
141
|
+
drag: 2.2,
|
|
142
|
+
spin: 9,
|
|
143
|
+
sway: .7,
|
|
144
|
+
swayRate: 3
|
|
145
|
+
}), M = {
|
|
146
|
+
gravity: -5.5,
|
|
147
|
+
drag: .5,
|
|
148
|
+
spin: 4
|
|
149
|
+
}, fe = D(s, [{
|
|
150
|
+
geometry: ue(),
|
|
151
|
+
material: O({
|
|
152
|
+
metalness: .6,
|
|
153
|
+
roughness: .25
|
|
154
|
+
}),
|
|
155
|
+
tinted: !0
|
|
156
|
+
}], Math.round(70 * A), M), pe = D(s, [{
|
|
157
|
+
geometry: new ce(.2, .07, o ? 8 : 12, o ? 18 : 28),
|
|
158
|
+
material: O({
|
|
159
|
+
metalness: .55,
|
|
160
|
+
roughness: .3
|
|
161
|
+
}),
|
|
162
|
+
tinted: !0
|
|
163
|
+
}], Math.round(50 * A), M), me = D(s, [
|
|
164
|
+
{
|
|
165
|
+
geometry: new n(.38, .38, .38),
|
|
166
|
+
material: O(),
|
|
167
|
+
tinted: !0
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
geometry: new n(.4, .4, .08),
|
|
171
|
+
material: k
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
geometry: new n(.08, .4, .4),
|
|
175
|
+
material: k
|
|
176
|
+
}
|
|
177
|
+
], Math.round(50 * A), M), he = new v(.07, 10, 8).translate(0, .27, 0), ge = D(s, [{
|
|
178
|
+
geometry: new c(.2, .5, o ? 12 : 20),
|
|
179
|
+
material: O(),
|
|
180
|
+
tinted: !0
|
|
181
|
+
}, {
|
|
182
|
+
geometry: he,
|
|
183
|
+
material: O()
|
|
184
|
+
}], Math.round(50 * A), M), N = D(s, [
|
|
185
|
+
{
|
|
186
|
+
geometry: new v(.32, o ? 14 : 24, o ? 12 : 18).scale(1, 1.18, 1),
|
|
187
|
+
material: O({
|
|
188
|
+
roughness: .15,
|
|
189
|
+
metalness: .1
|
|
190
|
+
}),
|
|
191
|
+
tinted: !0
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
geometry: new c(.06, .08, 8).translate(0, -.41, 0),
|
|
195
|
+
material: O(),
|
|
196
|
+
tinted: !0
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
geometry: new l(.006, .006, 1.1, 4).translate(0, -1, 0),
|
|
200
|
+
material: O()
|
|
201
|
+
}
|
|
202
|
+
], Math.round(24 * A), {
|
|
203
|
+
gravity: .9,
|
|
204
|
+
drag: 1.2,
|
|
205
|
+
spin: .4,
|
|
206
|
+
sway: .5,
|
|
207
|
+
swayRate: 1.4
|
|
208
|
+
}), P = [
|
|
209
|
+
fe,
|
|
210
|
+
pe,
|
|
211
|
+
me,
|
|
212
|
+
ge
|
|
213
|
+
], F = Array.from({ length: 3 }, () => de(o)), I = S.map((e) => E({
|
|
214
|
+
color: e,
|
|
215
|
+
side: d
|
|
216
|
+
}, { metalness: .3 })), L = Array.from({ length: o ? 8 : 16 }, () => {
|
|
217
|
+
let e = new ee(F[0], I[0]);
|
|
218
|
+
return e.visible = !1, s.add(e), {
|
|
219
|
+
mesh: e,
|
|
220
|
+
vel: new b(),
|
|
221
|
+
spin: new b(),
|
|
222
|
+
life: 0
|
|
223
|
+
};
|
|
224
|
+
}), R = 0, z = le(), B = o ? 260 : 600, V = new Float32Array(B * 3), H = new Float32Array(B * 3), U = new Float32Array(B * 3), W = new Float32Array(B), G = new i();
|
|
225
|
+
G.setAttribute("position", new r(V, 3)), G.setAttribute("color", new r(H, 3));
|
|
226
|
+
let K = new ae(G, new oe({
|
|
227
|
+
size: o ? .22 : .18,
|
|
228
|
+
map: z,
|
|
229
|
+
vertexColors: !0,
|
|
230
|
+
transparent: !0,
|
|
231
|
+
blending: e,
|
|
232
|
+
depthWrite: !1
|
|
233
|
+
}));
|
|
234
|
+
K.frustumCulled = !1, s.add(K);
|
|
235
|
+
let q = 0, J = 0, Y = 0, X = 0, Z = (e, t, n) => new b(e + w(-n, n), t + w(-n, n), w(-n, n) * .8).normalize(), Q = (e, t, n, { paperCount: r = 0, objectCount: i = 0, streamerCount: a = 0, spread: o = .35, speed: s = 11 }) => {
|
|
236
|
+
for (let i = 0; i < r * A; i += 1) j.spawn(e, Z(t, n, o).multiplyScalar(s * w(.5, 1.25)), w(.8, 1.3), w(4, 6.5));
|
|
237
|
+
for (let r = 0; r < i * A; r += 1) T(P).spawn(e, Z(t, n, o).multiplyScalar(s * w(.55, 1)), w(1.1, 1.8));
|
|
238
|
+
for (let r = 0; r < a; r += 1) ve(e, Z(t, n, o).multiplyScalar(s * w(.4, .75)));
|
|
239
|
+
}, _e = (e, { paperCount: t, objectCount: n = 0, streamerCount: r = 0, speed: i }) => {
|
|
240
|
+
for (let n = 0; n < t * A; n += 1) j.spawn(e, new b(w(-1, 1), w(-.6, 1.2), w(-1, 1)).normalize().multiplyScalar(i * w(.3, 1)), w(.8, 1.3), w(3.5, 6));
|
|
241
|
+
for (let t = 0; t < n * A; t += 1) T(P).spawn(e, new b(w(-1, 1), w(-.3, 1.2), w(-.6, .6)).normalize().multiplyScalar(i * w(.4, .8)), w(1.2, 2));
|
|
242
|
+
for (let t = 0; t < r; t += 1) ve(e, new b(w(-1, 1), w(0, 1), w(-.5, .5)).normalize().multiplyScalar(i * .5));
|
|
243
|
+
};
|
|
244
|
+
function ve(e, t) {
|
|
245
|
+
let n = L[R];
|
|
246
|
+
R = (R + 1) % L.length, n.mesh.geometry = T(F), n.mesh.material = T(I), n.mesh.position.copy(e), n.mesh.rotation.set(w(0, 6.3), w(0, 6.3), w(0, 6.3)), n.mesh.scale.setScalar(w(.7, 1.1)), n.mesh.visible = !0, n.vel.copy(t), n.spin.set(w(-2, 2), w(-3, 3), w(-2, 2)), n.life = w(3.5, 5.5);
|
|
247
|
+
}
|
|
248
|
+
let $ = (e, t, n, r = 0) => {
|
|
249
|
+
for (let i = 0; i < t * A; i += 1) {
|
|
250
|
+
let t = q;
|
|
251
|
+
q = (q + 1) % B;
|
|
252
|
+
let i = w(0, Math.PI * 2), a = r ? w(2.5, 5) : w(0, .4), o = [
|
|
253
|
+
e.x + Math.cos(i) * a,
|
|
254
|
+
e.y + Math.sin(i) * a * .7,
|
|
255
|
+
e.z + w(-1, 1)
|
|
256
|
+
];
|
|
257
|
+
V.set(o, t * 3);
|
|
258
|
+
let s = r ? [
|
|
259
|
+
-Math.sin(i) * r - Math.cos(i) * 1.4,
|
|
260
|
+
Math.cos(i) * r * .7 - Math.sin(i) * 1.4,
|
|
261
|
+
0
|
|
262
|
+
] : [
|
|
263
|
+
w(-1, 1) * n,
|
|
264
|
+
w(-.4, 1) * n,
|
|
265
|
+
w(-1, 1) * n
|
|
266
|
+
];
|
|
267
|
+
U.set(s, t * 3), W[t] = w(1.2, 2.6);
|
|
268
|
+
}
|
|
269
|
+
}, ye = {
|
|
270
|
+
cannons(e) {
|
|
271
|
+
let { halfWidth: t, halfHeight: n } = p;
|
|
272
|
+
Q(new b(-t * .95, -n * .95, 0), .45, 1, {
|
|
273
|
+
paperCount: 420 * e,
|
|
274
|
+
objectCount: 12,
|
|
275
|
+
streamerCount: 2
|
|
276
|
+
}), Q(new b(t * .95, -n * .95, 0), -.45, 1, {
|
|
277
|
+
paperCount: 420 * e,
|
|
278
|
+
objectCount: 12,
|
|
279
|
+
streamerCount: 2
|
|
280
|
+
}), $(new b(0, -n * .6, 0), 80, 3);
|
|
281
|
+
},
|
|
282
|
+
left(e) {
|
|
283
|
+
Q(new b(-p.halfWidth, -p.halfHeight * .4, .5), 1, .85, {
|
|
284
|
+
paperCount: 450 * e,
|
|
285
|
+
objectCount: 14,
|
|
286
|
+
streamerCount: 3,
|
|
287
|
+
speed: 12
|
|
288
|
+
});
|
|
289
|
+
},
|
|
290
|
+
right(e) {
|
|
291
|
+
Q(new b(p.halfWidth, -p.halfHeight * .4, .5), -1, .85, {
|
|
292
|
+
paperCount: 450 * e,
|
|
293
|
+
objectCount: 14,
|
|
294
|
+
streamerCount: 3,
|
|
295
|
+
speed: 12
|
|
296
|
+
});
|
|
297
|
+
},
|
|
298
|
+
rain(e) {
|
|
299
|
+
for (let t = 0; t < 520 * e * A; t += 1) j.spawn(new b(w(-p.halfWidth, p.halfWidth), p.halfHeight + w(.2, 2), w(-2, 2)), new b(w(-.5, .5), w(-2, 0), 0), w(.8, 1.3), w(4, 6));
|
|
300
|
+
for (let e = 0; e < 14 * A; e += 1) T(P).spawn(new b(w(-p.halfWidth, p.halfWidth) * .8, p.halfHeight + .5, w(-1, 1)), new b(0, w(-2, 0), 0), w(1.2, 1.9));
|
|
301
|
+
$(new b(0, p.halfHeight * .5, 0), 120, 2);
|
|
302
|
+
},
|
|
303
|
+
balloons(e) {
|
|
304
|
+
for (let e = 0; e < 14 * A; e += 1) N.spawn(new b(w(-p.halfWidth, p.halfWidth) * .85, -p.halfHeight - w(.5, 2.5), w(-2, 1)), new b(0, w(1.2, 2.4), 0), w(.85, 1.3), 8);
|
|
305
|
+
Q(new b(0, -p.halfHeight, 0), 0, 1, {
|
|
306
|
+
paperCount: 300 * e,
|
|
307
|
+
objectCount: 10,
|
|
308
|
+
spread: .6
|
|
309
|
+
});
|
|
310
|
+
},
|
|
311
|
+
sky(e) {
|
|
312
|
+
let t = new b(w(-.4, .4) * p.halfWidth, p.halfHeight * .45, 0);
|
|
313
|
+
_e(t, {
|
|
314
|
+
paperCount: 600 * e,
|
|
315
|
+
objectCount: 16,
|
|
316
|
+
streamerCount: 2,
|
|
317
|
+
speed: 7
|
|
318
|
+
}), $(t, 160, 4);
|
|
319
|
+
},
|
|
320
|
+
swirl() {
|
|
321
|
+
$(new b(0, .3, 0), 260, 0, 3.2);
|
|
322
|
+
},
|
|
323
|
+
finale() {
|
|
324
|
+
let e = new b(0, .3, 0);
|
|
325
|
+
_e(e, {
|
|
326
|
+
paperCount: 1500,
|
|
327
|
+
objectCount: 80,
|
|
328
|
+
streamerCount: 10,
|
|
329
|
+
speed: 14
|
|
330
|
+
}), $(e, 320, 7);
|
|
331
|
+
for (let e = 0; e < 8 * A; e += 1) N.spawn(new b(w(-p.halfWidth, p.halfWidth) * .8, -p.halfHeight - w(.5, 2), w(-1.5, 1)), new b(0, w(2, 3.2), 0), w(.9, 1.3), 5);
|
|
332
|
+
X = .7;
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
return {
|
|
336
|
+
burst(e, t = 1) {
|
|
337
|
+
ye[e]?.(t), Y = Math.max(Y, e === "finale" ? 1 : t * .5);
|
|
338
|
+
},
|
|
339
|
+
render(e) {
|
|
340
|
+
J += e, Y = Math.max(0, Y - e * 2.5), X = Math.max(0, X - e * 1.8), x.intensity = Y * 6 * m, _.position.set(Math.cos(J * .7) * 6, Math.sin(J * .9) * 3, 4), y.position.set(Math.cos(J * .7 + Math.PI) * 6, Math.sin(J * 1.1 + 1) * 3, 4), j.update(e, J, p), P.forEach((t) => t.update(e, J, p)), N.update(e, J, p), L.forEach((t) => {
|
|
341
|
+
t.mesh.visible && (t.life -= e, t.vel.y -= 2.2 * e, t.vel.multiplyScalar(Math.max(0, 1 - 1.5 * e)), t.mesh.position.addScaledVector(t.vel, e), t.mesh.rotation.x += t.spin.x * e, t.mesh.rotation.y += t.spin.y * e, t.mesh.rotation.z += t.spin.z * e, t.life <= 0 && (t.mesh.visible = !1));
|
|
342
|
+
});
|
|
343
|
+
for (let t = 0; t < B; t += 1) {
|
|
344
|
+
let n = t * 3;
|
|
345
|
+
if (W[t] <= 0) {
|
|
346
|
+
H[n] = 0, H[n + 1] = 0, H[n + 2] = 0;
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
W[t] -= e, U[n + 1] -= .8 * e, V[n] += U[n] * e, V[n + 1] += U[n + 1] * e, V[n + 2] += U[n + 2] * e;
|
|
350
|
+
let r = Math.min(1, W[t]) * (.35 + Math.random() * .65);
|
|
351
|
+
H[n] = r, H[n + 1] = r * .88, H[n + 2] = r * .6;
|
|
352
|
+
}
|
|
353
|
+
G.attributes.position.needsUpdate = !0, G.attributes.color.needsUpdate = !0, f.position.x = (Math.random() - .5) * X * .3, f.position.y = (Math.random() - .5) * X * .3, a.render(s, f);
|
|
354
|
+
},
|
|
355
|
+
resize(e, t) {
|
|
356
|
+
a.setSize(e, t, !1), f.aspect = e / t, f.fov = f.aspect < 1 ? Math.min(85, 50 / Math.max(f.aspect, .55) * .8) : 50, f.updateProjectionMatrix(), p.halfHeight = Math.tan(f.fov * Math.PI / 360) * C, p.halfWidth = p.halfHeight * f.aspect;
|
|
357
|
+
},
|
|
358
|
+
dispose() {
|
|
359
|
+
s.traverse((e) => {
|
|
360
|
+
e.isInstancedMesh && e.dispose(), e.geometry?.dispose(), e.material && [].concat(e.material).forEach((e) => e.dispose());
|
|
361
|
+
}), F.forEach((e) => e.dispose()), I.forEach((e) => e.dispose()), z.dispose(), a.dispose(), a.forceContextLoss?.();
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
export { O as createConfettiScene };
|
|
366
|
+
|
|
367
|
+
//# sourceMappingURL=confettiScene3d-WooGwo25.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confettiScene3d-WooGwo25.js","names":["PALETTE","Color","hex","DISTANCE","rand","min","max","pick","items","isLowPower","softDot","canvas","size","ctx","gradient","CanvasTexture","starGeometry","shape","Shape","i","radius","angle","x","y","geometry","ExtrudeGeometry","streamerGeometry","points","turns","t","Vector3","TubeGeometry","CatmullRomCurve3","lowPower","createPool","dummy","Object3D","meshes","parts","mesh","InstancedMesh","material","count","DynamicDrawUsage","tinted","scene","bodies","cursor","index","body","position","velocity","physics","life","color","drag","dt","time","outside","bounds","scale","m","createConfettiScene","renderer","WebGLRenderer","buildScene","error","Scene","camera","PerspectiveCamera","light","key","DirectionalLight","pink","PointLight","cyan","flash","AmbientLight","MeshLambertMaterial","options","MeshStandardMaterial","standard","white","gold","paper","PlaneGeometry","DoubleSide","rigid","stars","rings","TorusGeometry","gifts","BoxGeometry","pom","SphereGeometry","hats","ConeGeometry","balloons","CylinderGeometry","objects","streamerGeometries","streamerMaterials","streamers","Mesh","streamerCursor","dot","GLITTER","glitterPositions","glitterColors","glitterVelocity","glitterLife","glitterGeometry","BufferGeometry","BufferAttribute","glitter","Points","PointsMaterial","AdditiveBlending","glitterCursor","flashLevel","shake","direction","spread","cannon","paperCount","origin","speed","objectCount","streamerCount","shell","spawnStreamer","streamer","sparkle","n","swirl","bursts","w","h","power","kind","pool","p","twinkle","width","height","child","entry"],"sources":["../../src/effects/confetti/confettiScene3d.js"],"sourcesContent":["// Three.js party for the Confeti effect. Loaded lazily; `three` is an optional peer, so\n// ConfettiEffect falls back to the CSS confetti when this module or WebGL is unavailable.\n// Every body kind is one InstancedMesh per part, so thousands of pieces cost a few draw calls.\nimport {\n AdditiveBlending, AmbientLight, BoxGeometry, BufferAttribute, BufferGeometry, CanvasTexture, CatmullRomCurve3, Color,\n ConeGeometry, CylinderGeometry, DirectionalLight, DoubleSide, DynamicDrawUsage, ExtrudeGeometry, InstancedMesh, Mesh,\n MeshLambertMaterial, MeshStandardMaterial, Object3D, PerspectiveCamera, PlaneGeometry, PointLight, Points, PointsMaterial,\n Scene, Shape, SphereGeometry, TorusGeometry, TubeGeometry, Vector3, WebGLRenderer,\n} from 'three';\n\nconst PALETTE = ['#ff4d8d', '#ffd23f', '#3ddc97', '#4cc9f0', '#9b5de5', '#ff7b29', '#f15bb5', '#ffffff'].map((hex) => new Color(hex));\nconst DISTANCE = 12;\nconst rand = (min, max) => min + Math.random() * (max - min);\nconst pick = (items) => items[Math.floor(Math.random() * items.length)];\n\n// Phones and low-core devices get smaller pools, Lambert shading, no MSAA and a lower pixel ratio.\nconst isLowPower = () => (typeof matchMedia === 'function' && matchMedia('(pointer: coarse)').matches)\n || (navigator.hardwareConcurrency || 8) <= 4;\n\nfunction softDot(size = 64) {\n const canvas = document.createElement('canvas');\n canvas.width = size;\n canvas.height = size;\n const ctx = canvas.getContext('2d');\n const gradient = ctx.createRadialGradient(size / 2, size / 2, 0, size / 2, size / 2, size / 2);\n gradient.addColorStop(0, 'rgba(255,255,255,1)');\n gradient.addColorStop(0.35, 'rgba(255,255,255,.6)');\n gradient.addColorStop(1, 'rgba(255,255,255,0)');\n ctx.fillStyle = gradient;\n ctx.fillRect(0, 0, size, size);\n return new CanvasTexture(canvas);\n}\n\nfunction starGeometry() {\n const shape = new Shape();\n for (let i = 0; i < 10; i += 1) {\n const radius = i % 2 ? 0.14 : 0.32;\n const angle = (i / 10) * Math.PI * 2 + Math.PI / 2;\n const x = Math.cos(angle) * radius;\n const y = Math.sin(angle) * radius;\n if (i) shape.lineTo(x, y); else shape.moveTo(x, y);\n }\n const geometry = new ExtrudeGeometry(shape, { depth: 0.08, bevelEnabled: true, bevelThickness: 0.03, bevelSize: 0.02, bevelSegments: 1 });\n geometry.center();\n return geometry;\n}\n\n// Curly ribbon: a loose helix that tumbles as one rigid streamer.\nfunction streamerGeometry(lowPower) {\n const points = [];\n const turns = rand(2.5, 4);\n for (let i = 0; i <= 24; i += 1) {\n const t = i / 24;\n const angle = t * turns * Math.PI * 2;\n points.push(new Vector3(Math.cos(angle) * 0.18, t * 2.2 - 1.1, Math.sin(angle) * 0.18));\n }\n return new TubeGeometry(new CatmullRomCurve3(points), lowPower ? 60 : 110, 0.022, lowPower ? 3 : 4, false);\n}\n\n/**\n * A ring buffer of rigid bodies drawn by one InstancedMesh per part.\n * `tinted` parts take each body's palette color; the others keep their material color.\n */\nfunction createPool(scene, parts, count, physics) {\n const dummy = new Object3D();\n const meshes = parts.map(({ geometry, material, tinted }) => {\n const mesh = new InstancedMesh(geometry, material, count);\n mesh.instanceMatrix.setUsage(DynamicDrawUsage);\n mesh.frustumCulled = false;\n if (tinted) {\n for (let i = 0; i < count; i += 1) mesh.setColorAt(i, PALETTE[0]);\n mesh.instanceColor.setUsage(DynamicDrawUsage);\n }\n dummy.scale.setScalar(0);\n dummy.updateMatrix();\n for (let i = 0; i < count; i += 1) mesh.setMatrixAt(i, dummy.matrix);\n scene.add(mesh);\n return { mesh, tinted };\n });\n const bodies = Array.from({ length: count }, () => ({\n alive: false, pos: new Vector3(), vel: new Vector3(), rot: new Vector3(), spin: new Vector3(), size: 1, life: 0, phase: 0,\n }));\n let cursor = 0;\n return {\n spawn(position, velocity, size = 1, life = rand(4, 6)) {\n const index = cursor;\n cursor = (cursor + 1) % count;\n const body = bodies[index];\n body.alive = true;\n body.pos.copy(position);\n body.vel.copy(velocity);\n body.rot.set(rand(0, 6.3), rand(0, 6.3), rand(0, 6.3));\n body.spin.set(rand(-1, 1), rand(-1, 1), rand(-1, 1)).multiplyScalar(physics.spin);\n body.size = size;\n body.life = life;\n body.phase = rand(0, 6.3);\n const color = pick(PALETTE);\n meshes.forEach(({ mesh, tinted }) => {\n if (!tinted) return;\n mesh.setColorAt(index, color);\n mesh.instanceColor.needsUpdate = true;\n });\n },\n update(dt, time, bounds) {\n const drag = Math.max(0, 1 - physics.drag * dt);\n for (let i = 0; i < count; i += 1) {\n const body = bodies[i];\n if (!body.alive) continue;\n body.life -= dt;\n body.vel.y += physics.gravity * dt;\n body.vel.multiplyScalar(drag);\n body.pos.addScaledVector(body.vel, dt);\n // Paper and balloons sway as they drift; rigid objects only tumble.\n if (physics.sway) body.pos.x += Math.sin(time * physics.swayRate + body.phase) * physics.sway * dt;\n body.rot.addScaledVector(body.spin, dt);\n const outside = body.pos.y < -bounds.halfHeight - 2 || body.pos.y > bounds.halfHeight + 3;\n if (body.life <= 0 || outside) body.alive = false;\n // Shrink out over the last 0.4 s instead of popping.\n const scale = body.alive ? body.size * Math.min(1, body.life / 0.4) : 0;\n dummy.position.copy(body.pos);\n dummy.rotation.set(body.rot.x, body.rot.y, body.rot.z);\n dummy.scale.setScalar(scale);\n dummy.updateMatrix();\n for (let m = 0; m < meshes.length; m += 1) meshes[m].mesh.setMatrixAt(i, dummy.matrix);\n }\n meshes.forEach(({ mesh }) => { mesh.instanceMatrix.needsUpdate = true; });\n },\n };\n}\n\nexport function createConfettiScene(canvas) {\n const lowPower = isLowPower();\n const renderer = new WebGLRenderer({ canvas, alpha: true, antialias: !lowPower, powerPreference: 'high-performance' });\n // A failed setup must not keep the GL context alive.\n try {\n return buildScene(renderer, lowPower);\n } catch (error) {\n renderer.dispose();\n renderer.forceContextLoss?.();\n throw error;\n }\n}\n\nfunction buildScene(renderer, lowPower) {\n renderer.setPixelRatio(Math.min(lowPower ? 1.5 : 2, window.devicePixelRatio || 1));\n renderer.setClearColor(0x000000, 0);\n const scene = new Scene();\n const camera = new PerspectiveCamera(50, 1, 0.1, 80);\n camera.position.set(0, 0, DISTANCE);\n const bounds = { halfWidth: 6, halfHeight: 5.6 };\n\n // Lambert reflects more than the standard material, so its rig is dimmed to keep colors saturated.\n const light = lowPower ? 0.5 : 1;\n const key = new DirectionalLight(0xffffff, 1.1 * light);\n key.position.set(2, 4, 6);\n const pink = new PointLight(0xff5fa8, 1.4 * light, 30, 1.5);\n const cyan = new PointLight(0x4cc9f0, 1.4 * light, 30, 1.5);\n const flash = new PointLight(0xfff1c2, 0, 40, 1.4);\n flash.position.set(0, 0.5, 4);\n scene.add(new AmbientLight(0xffffff, 0.55 * light), key, pink, cyan, flash);\n\n const material = (options, standard = {}) => (lowPower\n ? new MeshLambertMaterial(options)\n : new MeshStandardMaterial({ roughness: 0.35, metalness: 0.2, ...options, ...standard }));\n const white = (standard) => material({ color: 0xffffff }, standard);\n const gold = material({ color: 0xffcf4a, emissive: 0x4a2d00 }, { metalness: 0.75, roughness: 0.25 });\n\n const scale = lowPower ? 0.5 : 1;\n const paper = createPool(scene, [{ geometry: new PlaneGeometry(0.14, 0.22), material: material({ color: 0xffffff, side: DoubleSide }, { metalness: 0.35, roughness: 0.4 }), tinted: true }],\n Math.round(2400 * scale), { gravity: -3.2, drag: 2.2, spin: 9, sway: 0.7, swayRate: 3 });\n const rigid = { gravity: -5.5, drag: 0.5, spin: 4 };\n const stars = createPool(scene, [{ geometry: starGeometry(), material: white({ metalness: 0.6, roughness: 0.25 }), tinted: true }], Math.round(70 * scale), rigid);\n const ringGeometry = new TorusGeometry(0.2, 0.07, lowPower ? 8 : 12, lowPower ? 18 : 28);\n const rings = createPool(scene, [{ geometry: ringGeometry, material: white({ metalness: 0.55, roughness: 0.3 }), tinted: true }], Math.round(50 * scale), rigid);\n const gifts = createPool(scene, [\n { geometry: new BoxGeometry(0.38, 0.38, 0.38), material: white(), tinted: true },\n { geometry: new BoxGeometry(0.4, 0.4, 0.08), material: gold },\n { geometry: new BoxGeometry(0.08, 0.4, 0.4), material: gold },\n ], Math.round(50 * scale), rigid);\n const pom = new SphereGeometry(0.07, 10, 8).translate(0, 0.27, 0);\n const hats = createPool(scene, [\n { geometry: new ConeGeometry(0.2, 0.5, lowPower ? 12 : 20), material: white(), tinted: true },\n { geometry: pom, material: white() },\n ], Math.round(50 * scale), rigid);\n const balloonBody = new SphereGeometry(0.32, lowPower ? 14 : 24, lowPower ? 12 : 18).scale(1, 1.18, 1);\n const balloons = createPool(scene, [\n { geometry: balloonBody, material: white({ roughness: 0.15, metalness: 0.1 }), tinted: true },\n { geometry: new ConeGeometry(0.06, 0.08, 8).translate(0, -0.41, 0), material: white(), tinted: true },\n { geometry: new CylinderGeometry(0.006, 0.006, 1.1, 4).translate(0, -1, 0), material: white() },\n ], Math.round(24 * scale), { gravity: 0.9, drag: 1.2, spin: 0.4, sway: 0.5, swayRate: 1.4 });\n const objects = [stars, rings, gifts, hats];\n\n const streamerGeometries = Array.from({ length: 3 }, () => streamerGeometry(lowPower));\n const streamerMaterials = PALETTE.map((color) => material({ color, side: DoubleSide }, { metalness: 0.3 }));\n const streamers = Array.from({ length: lowPower ? 8 : 16 }, () => {\n const mesh = new Mesh(streamerGeometries[0], streamerMaterials[0]);\n mesh.visible = false;\n scene.add(mesh);\n return { mesh, vel: new Vector3(), spin: new Vector3(), life: 0 };\n });\n let streamerCursor = 0;\n\n const dot = softDot();\n const GLITTER = lowPower ? 260 : 600;\n const glitterPositions = new Float32Array(GLITTER * 3);\n const glitterColors = new Float32Array(GLITTER * 3);\n const glitterVelocity = new Float32Array(GLITTER * 3);\n const glitterLife = new Float32Array(GLITTER);\n const glitterGeometry = new BufferGeometry();\n glitterGeometry.setAttribute('position', new BufferAttribute(glitterPositions, 3));\n glitterGeometry.setAttribute('color', new BufferAttribute(glitterColors, 3));\n const glitter = new Points(glitterGeometry, new PointsMaterial({ size: lowPower ? 0.22 : 0.18, map: dot, vertexColors: true, transparent: true, blending: AdditiveBlending, depthWrite: false }));\n glitter.frustumCulled = false;\n scene.add(glitter);\n let glitterCursor = 0;\n\n let time = 0;\n let flashLevel = 0;\n let shake = 0;\n\n const direction = (x, y, spread) => new Vector3(x + rand(-spread, spread), y + rand(-spread, spread), rand(-spread, spread) * 0.8).normalize();\n // A cone of pieces from `origin`; every kind gets its own share and speed.\n const cannon = (origin, x, y, { paperCount = 0, objectCount = 0, streamerCount = 0, spread = 0.35, speed = 11 }) => {\n for (let i = 0; i < paperCount * scale; i += 1) paper.spawn(origin, direction(x, y, spread).multiplyScalar(speed * rand(0.5, 1.25)), rand(0.8, 1.3), rand(4, 6.5));\n for (let i = 0; i < objectCount * scale; i += 1) pick(objects).spawn(origin, direction(x, y, spread).multiplyScalar(speed * rand(0.55, 1)), rand(1.1, 1.8));\n for (let i = 0; i < streamerCount; i += 1) spawnStreamer(origin, direction(x, y, spread).multiplyScalar(speed * rand(0.4, 0.75)));\n };\n // A sphere of pieces, like a firework shell.\n const shell = (origin, { paperCount, objectCount = 0, streamerCount = 0, speed }) => {\n for (let i = 0; i < paperCount * scale; i += 1) paper.spawn(origin, new Vector3(rand(-1, 1), rand(-0.6, 1.2), rand(-1, 1)).normalize().multiplyScalar(speed * rand(0.3, 1)), rand(0.8, 1.3), rand(3.5, 6));\n for (let i = 0; i < objectCount * scale; i += 1) pick(objects).spawn(origin, new Vector3(rand(-1, 1), rand(-0.3, 1.2), rand(-0.6, 0.6)).normalize().multiplyScalar(speed * rand(0.4, 0.8)), rand(1.2, 2));\n for (let i = 0; i < streamerCount; i += 1) spawnStreamer(origin, new Vector3(rand(-1, 1), rand(0, 1), rand(-0.5, 0.5)).normalize().multiplyScalar(speed * 0.5));\n };\n function spawnStreamer(origin, velocity) {\n const streamer = streamers[streamerCursor];\n streamerCursor = (streamerCursor + 1) % streamers.length;\n streamer.mesh.geometry = pick(streamerGeometries);\n streamer.mesh.material = pick(streamerMaterials);\n streamer.mesh.position.copy(origin);\n streamer.mesh.rotation.set(rand(0, 6.3), rand(0, 6.3), rand(0, 6.3));\n streamer.mesh.scale.setScalar(rand(0.7, 1.1));\n streamer.mesh.visible = true;\n streamer.vel.copy(velocity);\n streamer.spin.set(rand(-2, 2), rand(-3, 3), rand(-2, 2));\n streamer.life = rand(3.5, 5.5);\n }\n const sparkle = (origin, count, speed, swirl = 0) => {\n for (let n = 0; n < count * scale; n += 1) {\n const i = glitterCursor;\n glitterCursor = (glitterCursor + 1) % GLITTER;\n const angle = rand(0, Math.PI * 2);\n const radius = swirl ? rand(2.5, 5) : rand(0, 0.4);\n const position = [origin.x + Math.cos(angle) * radius, origin.y + Math.sin(angle) * radius * 0.7, origin.z + rand(-1, 1)];\n glitterPositions.set(position, i * 3);\n // Swirling glitter orbits inward to charge up the final blast.\n const velocity = swirl\n ? [-Math.sin(angle) * swirl - Math.cos(angle) * 1.4, Math.cos(angle) * swirl * 0.7 - Math.sin(angle) * 1.4, 0]\n : [rand(-1, 1) * speed, rand(-0.4, 1) * speed, rand(-1, 1) * speed];\n glitterVelocity.set(velocity, i * 3);\n glitterLife[i] = rand(1.2, 2.6);\n }\n };\n\n const bursts = {\n cannons(power) {\n const { halfWidth: w, halfHeight: h } = bounds;\n cannon(new Vector3(-w * 0.95, -h * 0.95, 0), 0.45, 1, { paperCount: 420 * power, objectCount: 12, streamerCount: 2 });\n cannon(new Vector3(w * 0.95, -h * 0.95, 0), -0.45, 1, { paperCount: 420 * power, objectCount: 12, streamerCount: 2 });\n sparkle(new Vector3(0, -h * 0.6, 0), 80, 3);\n },\n left(power) {\n cannon(new Vector3(-bounds.halfWidth, -bounds.halfHeight * 0.4, 0.5), 1, 0.85, { paperCount: 450 * power, objectCount: 14, streamerCount: 3, speed: 12 });\n },\n right(power) {\n cannon(new Vector3(bounds.halfWidth, -bounds.halfHeight * 0.4, 0.5), -1, 0.85, { paperCount: 450 * power, objectCount: 14, streamerCount: 3, speed: 12 });\n },\n rain(power) {\n for (let i = 0; i < 520 * power * scale; i += 1) {\n paper.spawn(new Vector3(rand(-bounds.halfWidth, bounds.halfWidth), bounds.halfHeight + rand(0.2, 2), rand(-2, 2)), new Vector3(rand(-0.5, 0.5), rand(-2, 0), 0), rand(0.8, 1.3), rand(4, 6));\n }\n for (let i = 0; i < 14 * scale; i += 1) pick(objects).spawn(new Vector3(rand(-bounds.halfWidth, bounds.halfWidth) * 0.8, bounds.halfHeight + 0.5, rand(-1, 1)), new Vector3(0, rand(-2, 0), 0), rand(1.2, 1.9));\n sparkle(new Vector3(0, bounds.halfHeight * 0.5, 0), 120, 2);\n },\n balloons(power) {\n for (let i = 0; i < 14 * scale; i += 1) {\n balloons.spawn(new Vector3(rand(-bounds.halfWidth, bounds.halfWidth) * 0.85, -bounds.halfHeight - rand(0.5, 2.5), rand(-2, 1)), new Vector3(0, rand(1.2, 2.4), 0), rand(0.85, 1.3), 8);\n }\n cannon(new Vector3(0, -bounds.halfHeight, 0), 0, 1, { paperCount: 300 * power, objectCount: 10, spread: 0.6 });\n },\n sky(power) {\n const origin = new Vector3(rand(-0.4, 0.4) * bounds.halfWidth, bounds.halfHeight * 0.45, 0);\n shell(origin, { paperCount: 600 * power, objectCount: 16, streamerCount: 2, speed: 7 });\n sparkle(origin, 160, 4);\n },\n swirl() {\n sparkle(new Vector3(0, 0.3, 0), 260, 0, 3.2);\n },\n finale() {\n const origin = new Vector3(0, 0.3, 0);\n shell(origin, { paperCount: 1500, objectCount: 80, streamerCount: 10, speed: 14 });\n sparkle(origin, 320, 7);\n for (let i = 0; i < 8 * scale; i += 1) {\n balloons.spawn(new Vector3(rand(-bounds.halfWidth, bounds.halfWidth) * 0.8, -bounds.halfHeight - rand(0.5, 2), rand(-1.5, 1)), new Vector3(0, rand(2, 3.2), 0), rand(0.9, 1.3), 5);\n }\n shake = 0.7;\n },\n };\n\n return {\n burst(kind, power = 1) {\n bursts[kind]?.(power);\n flashLevel = Math.max(flashLevel, kind === 'finale' ? 1 : power * 0.5);\n },\n render(dt) {\n time += dt;\n flashLevel = Math.max(0, flashLevel - dt * 2.5);\n shake = Math.max(0, shake - dt * 1.8);\n flash.intensity = flashLevel * 6 * light;\n pink.position.set(Math.cos(time * 0.7) * 6, Math.sin(time * 0.9) * 3, 4);\n cyan.position.set(Math.cos(time * 0.7 + Math.PI) * 6, Math.sin(time * 1.1 + 1) * 3, 4);\n\n paper.update(dt, time, bounds);\n objects.forEach((pool) => pool.update(dt, time, bounds));\n balloons.update(dt, time, bounds);\n streamers.forEach((streamer) => {\n if (!streamer.mesh.visible) return;\n streamer.life -= dt;\n streamer.vel.y -= 2.2 * dt;\n streamer.vel.multiplyScalar(Math.max(0, 1 - 1.5 * dt));\n streamer.mesh.position.addScaledVector(streamer.vel, dt);\n streamer.mesh.rotation.x += streamer.spin.x * dt;\n streamer.mesh.rotation.y += streamer.spin.y * dt;\n streamer.mesh.rotation.z += streamer.spin.z * dt;\n if (streamer.life <= 0) streamer.mesh.visible = false;\n });\n\n for (let i = 0; i < GLITTER; i += 1) {\n const p = i * 3;\n if (glitterLife[i] <= 0) { glitterColors[p] = 0; glitterColors[p + 1] = 0; glitterColors[p + 2] = 0; continue; }\n glitterLife[i] -= dt;\n glitterVelocity[p + 1] -= 0.8 * dt;\n glitterPositions[p] += glitterVelocity[p] * dt;\n glitterPositions[p + 1] += glitterVelocity[p + 1] * dt;\n glitterPositions[p + 2] += glitterVelocity[p + 2] * dt;\n // Random twinkle in warm gold-white.\n const twinkle = Math.min(1, glitterLife[i]) * (0.35 + Math.random() * 0.65);\n glitterColors[p] = twinkle;\n glitterColors[p + 1] = twinkle * 0.88;\n glitterColors[p + 2] = twinkle * 0.6;\n }\n glitterGeometry.attributes.position.needsUpdate = true;\n glitterGeometry.attributes.color.needsUpdate = true;\n\n camera.position.x = (Math.random() - 0.5) * shake * 0.3;\n camera.position.y = (Math.random() - 0.5) * shake * 0.3;\n renderer.render(scene, camera);\n },\n resize(width, height) {\n renderer.setSize(width, height, false);\n camera.aspect = width / height;\n // Portrait chat windows widen the lens so cannons at the edges stay on screen.\n camera.fov = camera.aspect < 1 ? Math.min(85, (50 / Math.max(camera.aspect, 0.55)) * 0.8) : 50;\n camera.updateProjectionMatrix();\n bounds.halfHeight = Math.tan((camera.fov * Math.PI) / 360) * DISTANCE;\n bounds.halfWidth = bounds.halfHeight * camera.aspect;\n },\n dispose() {\n scene.traverse((child) => {\n // InstancedMesh owns the instanceMatrix/instanceColor GPU buffers.\n if (child.isInstancedMesh) child.dispose();\n child.geometry?.dispose();\n if (child.material) [].concat(child.material).forEach((entry) => entry.dispose());\n });\n streamerGeometries.forEach((geometry) => geometry.dispose());\n streamerMaterials.forEach((entry) => entry.dispose());\n dot.dispose();\n renderer.dispose();\n renderer.forceContextL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KAAK,KAAK,OAAO,IAAI,MAAOtB,IAAQ,IACpD,EAAO,SAAS,KAAK,KAAK,OAAO,IAAI,MAAOA,IAAQ,IACpDzD,EAAS,OAAOlB,GAAOuB,CAAM;EAC/B;EACA,OAAO,GAAO,GAAQ;GAOpB,AANAL,EAAS,QAAQgF,GAAOC,GAAQ,EAAK,GACrC,EAAO,SAASD,IAAQC,GAExB,EAAO,MAAM5E,EAAO,SAAS,IAAI,KAAK,IAAI,IAAK,KAAK,KAAK,IAAIA,EAAO,QAAQ,GAAI,IAAK,EAAG,IAAI,IAC5FA,EAAO,uBAAuB,GAC9B,EAAO,aAAa,KAAK,IAAKA,EAAO,MAAM,KAAK,KAAM,GAAG,IAAIjE,GAC7D,EAAO,YAAYwD,EAAO,aAAaS,EAAO;EAChD;EACA,UAAU;GAWR,AAVAvB,EAAM,UAAU,MAAU;IAIxB,AAFIoG,EAAM,mBAAiBA,EAAM,QAAQ,GACzCA,EAAM,UAAU,QAAQ,GACpBA,EAAM,YAAU,CAAC,CAAC,CAAC,OAAOA,EAAM,QAAQ,CAAC,CAAC,SAAS,MAAUC,EAAM,QAAQ,CAAC;GAClF,CAAC,GACD9C,EAAmB,SAAS,MAAa5E,EAAS,QAAQ,CAAC,GAC3D6E,EAAkB,SAAS,MAAU6C,EAAM,QAAQ,CAAC,GACpDzC,EAAI,QAAQ,GACZ1C,EAAS,QAAQ,GACjBA,EAAS,mBAAmB;EAC9B;CACF;AACF"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { i as e } from "./timeline-BLBedCYj.js";
|
|
2
|
+
import { AdditiveBlending as t, AmbientLight as n, BufferAttribute as r, BufferGeometry as i, CanvasTexture as a, Color as o, CurvePath as s, ExtrudeGeometry as c, Group as l, IcosahedronGeometry as u, Line as d, LineBasicMaterial as ee, LineCurve3 as f, Mesh as p, MeshBasicMaterial as m, MeshStandardMaterial as h, PerspectiveCamera as te, PointLight as g, Points as _, PointsMaterial as v, Scene as ne, Shape as y, TubeGeometry as b, Vector3 as x, WebGLRenderer as re } from "three";
|
|
3
|
+
// src/effects/thunder/thunderScene3d.js
|
|
4
|
+
var ie = 3, ae = 14, S = (e, t) => e + Math.random() * (t - e);
|
|
5
|
+
function oe(e = 64) {
|
|
6
|
+
let t = document.createElement("canvas");
|
|
7
|
+
t.width = e, t.height = e;
|
|
8
|
+
let n = t.getContext("2d"), r = n.createRadialGradient(e / 2, e / 2, 0, e / 2, e / 2, e / 2);
|
|
9
|
+
return r.addColorStop(0, "rgba(255,255,255,1)"), r.addColorStop(.4, "rgba(255,255,255,.5)"), r.addColorStop(1, "rgba(255,255,255,0)"), n.fillStyle = r, n.fillRect(0, 0, e, e), new a(t);
|
|
10
|
+
}
|
|
11
|
+
function C(e, t, n, r) {
|
|
12
|
+
let i = [e, t];
|
|
13
|
+
for (let e = 0; e < n; e += 1) {
|
|
14
|
+
let e = [i[0]];
|
|
15
|
+
for (let t = 1; t < i.length; t += 1) {
|
|
16
|
+
let n = i[t - 1], a = i[t], o = n.distanceTo(a), s = n.clone().lerp(a, .5);
|
|
17
|
+
s.x += S(-.5, .5) * o * r, s.y += S(-.5, .5) * o * r * .2, s.z += S(-.5, .5) * o * r * .6, e.push(s, a);
|
|
18
|
+
}
|
|
19
|
+
i = e;
|
|
20
|
+
}
|
|
21
|
+
return i;
|
|
22
|
+
}
|
|
23
|
+
function w(e, t, n) {
|
|
24
|
+
let r = new s();
|
|
25
|
+
for (let t = 1; t < e.length; t += 1) r.add(new f(e[t - 1], e[t]));
|
|
26
|
+
return new p(new b(r, e.length * 2, t, 5, !1), n);
|
|
27
|
+
}
|
|
28
|
+
function se(e, n, r) {
|
|
29
|
+
let i = new l(), a = new m({
|
|
30
|
+
color: 16777215,
|
|
31
|
+
transparent: !0,
|
|
32
|
+
blending: t,
|
|
33
|
+
depthWrite: !1
|
|
34
|
+
}), o = new m({
|
|
35
|
+
color: 8366335,
|
|
36
|
+
transparent: !0,
|
|
37
|
+
opacity: .4,
|
|
38
|
+
blending: t,
|
|
39
|
+
depthWrite: !1
|
|
40
|
+
}), s = .6 + r, c = (e, t) => {
|
|
41
|
+
i.add(w(e, .03 * t * s, a)), i.add(w(e, .16 * t * s, o));
|
|
42
|
+
}, u = C(e, n, 6, .45);
|
|
43
|
+
c(u, 1);
|
|
44
|
+
let d = 2 + Math.round(r * 3);
|
|
45
|
+
for (let e = 0; e < d; e += 1) {
|
|
46
|
+
let e = u[Math.floor(S(.15, .7) * u.length)];
|
|
47
|
+
c(C(e, e.clone().add(new x(S(-1.8, 1.8), S(-2.2, -.8), S(-.6, .6))), 4, .5), .45);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
group: i,
|
|
51
|
+
core: a,
|
|
52
|
+
glow: o,
|
|
53
|
+
age: 0
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function T(e) {
|
|
57
|
+
e.traverse((e) => {
|
|
58
|
+
e.geometry?.dispose(), e.material && [].concat(e.material).forEach((e) => e.dispose());
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function ce() {
|
|
62
|
+
let e = new y();
|
|
63
|
+
[
|
|
64
|
+
[.15, 1.6],
|
|
65
|
+
[-.7, -.1],
|
|
66
|
+
[-.05, -.1],
|
|
67
|
+
[-.3, -1.6],
|
|
68
|
+
[.75, .25],
|
|
69
|
+
[.1, .25],
|
|
70
|
+
[.55, 1.6]
|
|
71
|
+
].forEach(([t, n], r) => r ? e.lineTo(t, n) : e.moveTo(t, n));
|
|
72
|
+
let t = new c(e, {
|
|
73
|
+
depth: .32,
|
|
74
|
+
bevelEnabled: !0,
|
|
75
|
+
bevelThickness: .08,
|
|
76
|
+
bevelSize: .06,
|
|
77
|
+
bevelSegments: 3
|
|
78
|
+
});
|
|
79
|
+
t.center();
|
|
80
|
+
let n = new h({
|
|
81
|
+
color: 16765503,
|
|
82
|
+
emissive: 16747008,
|
|
83
|
+
emissiveIntensity: .5,
|
|
84
|
+
metalness: .35,
|
|
85
|
+
roughness: .3
|
|
86
|
+
});
|
|
87
|
+
return new p(t, n);
|
|
88
|
+
}
|
|
89
|
+
var le = () => typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches || (navigator.hardwareConcurrency || 8) <= 4;
|
|
90
|
+
function E(a, { reducedMotion: s = !1 } = {}) {
|
|
91
|
+
let c = le(), f = c ? 360 : 700, h = c ? 50 : 90, y = new re({
|
|
92
|
+
canvas: a,
|
|
93
|
+
alpha: !0,
|
|
94
|
+
antialias: !c,
|
|
95
|
+
powerPreference: "high-performance"
|
|
96
|
+
});
|
|
97
|
+
y.setPixelRatio(Math.min(c ? 1.5 : 2, window.devicePixelRatio || 1)), y.setClearColor(0, 0);
|
|
98
|
+
let b = new ne(), C = new te(50, 1, .1, 60);
|
|
99
|
+
C.position.set(0, .3, 7.5);
|
|
100
|
+
let w = new g(13623551, 0, 30, 1.6);
|
|
101
|
+
w.position.set(0, 4, 2);
|
|
102
|
+
let E = new g(16758062, 1.2, 8, 2);
|
|
103
|
+
E.position.set(0, .5, 1.6), b.add(new n(6977736, .35), w, E);
|
|
104
|
+
let D = oe(), O = new Float32Array(h * 3);
|
|
105
|
+
for (let e = 0; e < h; e += 1) O.set([
|
|
106
|
+
S(-9, 9),
|
|
107
|
+
S(2.6, 4.6),
|
|
108
|
+
S(-7, -1.5)
|
|
109
|
+
], e * 3);
|
|
110
|
+
let k = new i();
|
|
111
|
+
k.setAttribute("position", new r(O, 3));
|
|
112
|
+
let A = new o(2501706), ue = new o(12175615), j = new v({
|
|
113
|
+
size: 5.5,
|
|
114
|
+
map: D,
|
|
115
|
+
color: A.clone(),
|
|
116
|
+
transparent: !0,
|
|
117
|
+
opacity: .9,
|
|
118
|
+
depthWrite: !1
|
|
119
|
+
}), M = new _(k, j);
|
|
120
|
+
b.add(M);
|
|
121
|
+
let N = ce(), P = new m({
|
|
122
|
+
color: 7328767,
|
|
123
|
+
wireframe: !0,
|
|
124
|
+
transparent: !0,
|
|
125
|
+
opacity: .15,
|
|
126
|
+
blending: t,
|
|
127
|
+
depthWrite: !1
|
|
128
|
+
}), F = new p(new u(1.75, 1), P), I = new ee({
|
|
129
|
+
color: 10476799,
|
|
130
|
+
transparent: !0,
|
|
131
|
+
opacity: .5,
|
|
132
|
+
blending: t,
|
|
133
|
+
depthWrite: !1
|
|
134
|
+
}), L = Array.from({ length: ie }, () => {
|
|
135
|
+
let e = new i();
|
|
136
|
+
return e.setAttribute("position", new r(/* @__PURE__ */ new Float32Array(42), 3)), new d(e, I);
|
|
137
|
+
}), R = new l();
|
|
138
|
+
R.add(N, F, ...L), b.add(R);
|
|
139
|
+
let z = new Float32Array(f * 3), B = new Float32Array(f * 3), V = new Float32Array(f * 3), H = new Float32Array(f), U = new Float32Array(f).fill(1), W = new i();
|
|
140
|
+
W.setAttribute("position", new r(z, 3)), W.setAttribute("color", new r(B, 3));
|
|
141
|
+
let G = new _(W, new v({
|
|
142
|
+
size: c ? .14 : .12,
|
|
143
|
+
map: D,
|
|
144
|
+
vertexColors: !0,
|
|
145
|
+
transparent: !0,
|
|
146
|
+
blending: t,
|
|
147
|
+
depthWrite: !1
|
|
148
|
+
}));
|
|
149
|
+
G.frustumCulled = !1, b.add(G);
|
|
150
|
+
let K = [], q = 0, J = 0, Y = 0, X = 0, Z = 0, Q = 0, $ = (e, t, n) => {
|
|
151
|
+
for (let r = 0; r < t; r += 1) {
|
|
152
|
+
let t = q;
|
|
153
|
+
q = (q + 1) % f, z.set([
|
|
154
|
+
e.x + S(-.1, .1),
|
|
155
|
+
e.y + S(-.1, .1),
|
|
156
|
+
e.z + S(-.1, .1)
|
|
157
|
+
], t * 3), V.set([
|
|
158
|
+
S(-1, 1) * n,
|
|
159
|
+
S(.2, 1.4) * n,
|
|
160
|
+
S(-1, 1) * n * .6
|
|
161
|
+
], t * 3), U[t] = S(.5, 1.3), H[t] = U[t];
|
|
162
|
+
}
|
|
163
|
+
}, de = (e, t, n) => {
|
|
164
|
+
let r = se(e, t, n);
|
|
165
|
+
K.push(r), b.add(r.group);
|
|
166
|
+
}, fe = () => {
|
|
167
|
+
L.forEach((e) => {
|
|
168
|
+
let t = new x(S(-1, 1), S(-1, 1), S(-1, 1)).setLength(1.2), n = t.clone().add(new x(S(-1, 1), S(-1, 1), S(-1, 1)).setLength(S(.5, 1.1))), r = e.geometry.attributes.position;
|
|
169
|
+
for (let e = 0; e < ae; e += 1) {
|
|
170
|
+
let i = t.clone().lerp(n, e / 13), a = e === 0 || e === 13 ? 0 : .12;
|
|
171
|
+
r.setXYZ(e, i.x + S(-a, a), i.y + S(-a, a), i.z + S(-a, a));
|
|
172
|
+
}
|
|
173
|
+
r.needsUpdate = !0;
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
return {
|
|
177
|
+
strike(e = 1, t = 0) {
|
|
178
|
+
let n = new x(t * 4 + S(-.6, .6), 4.6, S(-2.5, -.5)), r = e >= .9, i = r ? new x(R.position.x + S(-.2, .2), R.position.y + 1.3, .2) : new x(t * 4.5 + S(-1.2, 1.2), -3.4, S(-1.5, .5));
|
|
179
|
+
de(n, i, e), e > .7 && de(new x(-n.x * .6 + S(-1, 1), 4.6, S(-3, -1)), new x(S(-5, 5), -3.4, S(-2, 0)), e * .5), $(i, Math.round((c ? 90 : 160) * e), 3.5 + e * 2.5), w.position.x = n.x, Y = Math.max(Y, e), s || (X = Math.max(X, e)), r && (Z = 1);
|
|
180
|
+
},
|
|
181
|
+
render(t) {
|
|
182
|
+
J += t, Y = Math.max(0, Y - t * 3.2), X = Math.max(0, X - t * 2.2), Z = Math.max(0, Z - t * 2.5), w.intensity = Y * 9, E.intensity = 1.2 + Y * 3, j.color.copy(A).lerp(ue, Math.min(1, Y * 1.1)), M.position.x = Math.sin(J * .1) * .4;
|
|
183
|
+
let n = Math.min(1, J / .6), r = 1 + 1.7 * (n - 1) ** 3 + .7 * (n - 1) ** 2;
|
|
184
|
+
R.scale.setScalar(Math.max(.001, r * (1 + Z * Z * .22))), R.position.y = .2 + Math.sin(J * 1.6) * .12, N.rotation.y = J * .9, N.material.emissiveIntensity = .5 + Y * 2.5, F.rotation.set(J * .3, J * .45, 0), P.opacity = .12 + Y * .5, I.opacity = .35 + Y * .65, Q -= t, Q <= 0 && (fe(), Q = .06), Math.random() < t * 6 && $(R.position.clone().add(new x(S(-.6, .6), S(-1, 1), .3)), 4, 1.5), C.position.x = (Math.random() - .5) * X * .35, C.position.y = .3 + (Math.random() - .5) * X * .25, C.lookAt(0, .4, 0);
|
|
185
|
+
for (let n = K.length - 1; n >= 0; --n) {
|
|
186
|
+
let r = K[n];
|
|
187
|
+
if (r.age += t, r.age >= .55) {
|
|
188
|
+
b.remove(r.group), T(r.group), K.splice(n, 1);
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
let i = e(r.age);
|
|
192
|
+
r.core.opacity = i, r.glow.opacity = .4 * i;
|
|
193
|
+
}
|
|
194
|
+
for (let e = 0; e < f; e += 1) {
|
|
195
|
+
let n = e * 3;
|
|
196
|
+
if (H[e] <= 0) {
|
|
197
|
+
B[n] = 0, B[n + 1] = 0, B[n + 2] = 0;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
H[e] -= t, V[n + 1] -= 7 * t;
|
|
201
|
+
let r = 1 - 1.5 * t;
|
|
202
|
+
V[n] *= r, V[n + 1] *= r, V[n + 2] *= r, z[n] += V[n] * t, z[n + 1] += V[n + 1] * t, z[n + 2] += V[n + 2] * t;
|
|
203
|
+
let i = Math.max(0, H[e] / U[e]);
|
|
204
|
+
B[n] = i, B[n + 1] = (.55 + .45 * i) * i, B[n + 2] = (.35 + .65 * i) * i;
|
|
205
|
+
}
|
|
206
|
+
W.attributes.position.needsUpdate = !0, W.attributes.color.needsUpdate = !0, y.render(b, C);
|
|
207
|
+
},
|
|
208
|
+
resize(e, t) {
|
|
209
|
+
y.setSize(e, t, !1), C.aspect = e / t, C.fov = C.aspect < 1 ? Math.min(85, 50 / Math.max(C.aspect, .55) * .8) : 50, C.updateProjectionMatrix();
|
|
210
|
+
},
|
|
211
|
+
dispose() {
|
|
212
|
+
K.length = 0, T(b), D.dispose(), y.dispose(), y.forceContextLoss?.();
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
export { E as createThunderScene };
|
|
217
|
+
|
|
218
|
+
//# sourceMappingURL=thunderScene3d-FMMuwJRP.js.map
|