@sarthak03dot/romantic-animations 1.0.2 → 1.2.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.
@@ -0,0 +1,727 @@
1
+ const y = {
2
+ zIndex: 0
3
+ };
4
+ function b(e, l = {}) {
5
+ const n = Object.assign({}, y, l), o = typeof e == "string" ? document.getElementById(e) : e;
6
+ if (!o)
7
+ throw new Error(
8
+ `[romantic-animations] Container "${e}" not found in the DOM.`
9
+ );
10
+ const a = o.querySelector("canvas[data-ra]");
11
+ a && a.remove();
12
+ const f = document.createElement("canvas");
13
+ f.setAttribute("data-ra", "1"), f.style.cssText = `
14
+ position: fixed;
15
+ top: 0;
16
+ left: 0;
17
+ width: 100vw;
18
+ height: 100vh;
19
+ pointer-events: none;
20
+ z-index: ${n.zIndex};
21
+ `;
22
+ const d = () => {
23
+ f.width = window.innerWidth, f.height = window.innerHeight;
24
+ };
25
+ d(), o.style.position = o.style.position || "relative", o.appendChild(f);
26
+ const c = new ResizeObserver(d);
27
+ c.observe(o);
28
+ const r = f.getContext("2d");
29
+ function t() {
30
+ c.disconnect(), f.remove();
31
+ }
32
+ return { canvas: f, ctx: r, options: n, destroy: t };
33
+ }
34
+ function u(e, l = {}) {
35
+ return Object.assign({}, e, l);
36
+ }
37
+ const z = {
38
+ count: 0.12,
39
+ // hearts spawned per frame (probability)
40
+ minSize: 14,
41
+ maxSize: 32,
42
+ minSpeed: 0.8,
43
+ maxSpeed: 2.4,
44
+ colors: ["#ff6b8a", "#ff4d6d", "#ff85a1", "#ffc2d1", "#ff0a54", "#ff477e"],
45
+ wobble: !0,
46
+ // horizontal sine drift
47
+ glow: !0
48
+ };
49
+ function x(e, l, n, o, a, f = 1, d = !1) {
50
+ e.save(), e.globalAlpha = f, d && (e.shadowColor = a, e.shadowBlur = o * 1.2), e.fillStyle = a, e.beginPath(), e.moveTo(l, n + o * 0.3), e.bezierCurveTo(l - o * 1.1, n - o * 0.5, l - o * 1.6, n + o * 0.5, l, n + o * 1.4), e.bezierCurveTo(l + o * 1.6, n + o * 0.5, l + o * 1.1, n - o * 0.5, l, n + o * 0.3), e.fill(), e.restore();
51
+ }
52
+ function C(e, l = {}) {
53
+ const n = u(z, l), o = e.getContext("2d"), a = [];
54
+ let f = !0;
55
+ function d() {
56
+ const r = n.minSize + Math.random() * (n.maxSize - n.minSize);
57
+ return {
58
+ x: Math.random() * e.width,
59
+ y: e.height + r * 2,
60
+ size: r,
61
+ speed: n.minSpeed + Math.random() * (n.maxSpeed - n.minSpeed),
62
+ color: n.colors[Math.floor(Math.random() * n.colors.length)],
63
+ alpha: 0.7 + Math.random() * 0.3,
64
+ wobbleOffset: Math.random() * Math.PI * 2,
65
+ wobbleSpeed: 0.02 + Math.random() * 0.03,
66
+ wobbleAmount: 0.5 + Math.random() * 1.5
67
+ };
68
+ }
69
+ function c() {
70
+ if (f) {
71
+ o.clearRect(0, 0, e.width, e.height), Math.random() < n.count && a.push(d());
72
+ for (let r = a.length - 1; r >= 0; r--) {
73
+ const t = a[r];
74
+ t.y -= t.speed, t.wobbleOffset += t.wobbleSpeed;
75
+ const i = n.wobble ? Math.sin(t.wobbleOffset) * t.wobbleAmount * t.size * 0.5 : 0, h = Math.min(t.alpha, t.y / (e.height * 0.2));
76
+ if (h <= 0 || t.y < -t.size * 3) {
77
+ a.splice(r, 1);
78
+ continue;
79
+ }
80
+ x(o, t.x + i, t.y, t.size, t.color, Math.max(0, h), n.glow);
81
+ }
82
+ requestAnimationFrame(c);
83
+ }
84
+ }
85
+ return c(), function() {
86
+ f = !1, o.clearRect(0, 0, e.width, e.height);
87
+ };
88
+ }
89
+ const A = {
90
+ minSize: 6,
91
+ maxSize: 16,
92
+ decay: 0.025,
93
+ colors: ["#ff6b8a", "#ff4d6d", "#ff85a1", "#ffc2d1", "#c9184a"],
94
+ glow: !0
95
+ };
96
+ function P(e, l, n, o, a, f, d) {
97
+ e.save(), e.globalAlpha = Math.max(0, f), d && (e.shadowColor = a, e.shadowBlur = o * 2), e.fillStyle = a, e.beginPath(), e.moveTo(l, n + o * 0.3), e.bezierCurveTo(l - o * 1.1, n - o * 0.5, l - o * 1.6, n + o * 0.5, l, n + o * 1.4), e.bezierCurveTo(l + o * 1.6, n + o * 0.5, l + o * 1.1, n - o * 0.5, l, n + o * 0.3), e.fill(), e.restore();
98
+ }
99
+ function T(e, l = {}) {
100
+ const n = u(A, l), o = e.getContext("2d"), a = [];
101
+ let f = !0;
102
+ function d(i, h) {
103
+ a.push({
104
+ x: i,
105
+ y: h,
106
+ size: n.minSize + Math.random() * (n.maxSize - n.minSize),
107
+ alpha: 0.9 + Math.random() * 0.1,
108
+ decay: n.decay * (0.8 + Math.random() * 0.4),
109
+ color: n.colors[Math.floor(Math.random() * n.colors.length)],
110
+ vy: -(0.3 + Math.random() * 0.6)
111
+ // drift upward
112
+ });
113
+ }
114
+ const c = (i) => {
115
+ const h = e.getBoundingClientRect();
116
+ d(i.clientX - h.left, i.clientY - h.top);
117
+ }, r = (i) => {
118
+ const h = e.getBoundingClientRect();
119
+ Array.from(i.touches).forEach((s) => {
120
+ d(s.clientX - h.left, s.clientY - h.top);
121
+ });
122
+ };
123
+ window.addEventListener("mousemove", c), window.addEventListener("touchmove", r, { passive: !0 });
124
+ function t() {
125
+ if (f) {
126
+ o.clearRect(0, 0, e.width, e.height);
127
+ for (let i = a.length - 1; i >= 0; i--) {
128
+ const h = a[i];
129
+ h.y += h.vy, P(o, h.x, h.y, h.size, h.color, h.alpha, n.glow), h.alpha -= h.decay, h.alpha <= 0 && a.splice(i, 1);
130
+ }
131
+ requestAnimationFrame(t);
132
+ }
133
+ }
134
+ return t(), function() {
135
+ f = !1, window.removeEventListener("mousemove", c), window.removeEventListener("touchmove", r), o.clearRect(0, 0, e.width, e.height);
136
+ };
137
+ }
138
+ const R = {
139
+ count: 20,
140
+ // hearts per burst
141
+ minSize: 8,
142
+ maxSize: 20,
143
+ minSpeed: 2,
144
+ maxSpeed: 7,
145
+ gravity: 0.08,
146
+ decay: 0.018,
147
+ colors: ["#ff0a54", "#ff477e", "#ff7096", "#ff85a1", "#fbb1bd", "#ff4d6d"],
148
+ glow: !0,
149
+ symbols: ["heart"]
150
+ // 'heart' | 'star' | 'sparkle'
151
+ };
152
+ function D(e, l, n, o, a, f, d, c) {
153
+ if (e.save(), e.globalAlpha = Math.max(0, d), c && (e.shadowColor = f, e.shadowBlur = a * 2), e.fillStyle = f, l === "star") {
154
+ e.beginPath();
155
+ for (let r = 0; r < 5; r++) {
156
+ const t = Math.PI / 2 + r * 2 * Math.PI / 5, i = t + Math.PI / 5;
157
+ r === 0 ? e.moveTo(n + a * Math.cos(t), o - a * Math.sin(t)) : e.lineTo(n + a * Math.cos(t), o - a * Math.sin(t)), e.lineTo(n + a * 0.4 * Math.cos(i), o - a * 0.4 * Math.sin(i));
158
+ }
159
+ e.closePath(), e.fill();
160
+ } else if (l === "sparkle")
161
+ for (let r = 0; r < 4; r++) {
162
+ const t = r * Math.PI / 2;
163
+ e.beginPath(), e.ellipse(n + Math.cos(t) * a * 0.5, o + Math.sin(t) * a * 0.5, a * 0.18, a * 0.7, t, 0, Math.PI * 2), e.fill();
164
+ }
165
+ else
166
+ e.beginPath(), e.moveTo(n, o + a * 0.3), e.bezierCurveTo(n - a * 1.1, o - a * 0.5, n - a * 1.6, o + a * 0.5, n, o + a * 1.4), e.bezierCurveTo(n + a * 1.6, o + a * 0.5, n + a * 1.1, o - a * 0.5, n, o + a * 0.3), e.fill();
167
+ e.restore();
168
+ }
169
+ function F(e, l = {}) {
170
+ const n = u(R, l), o = e.getContext("2d"), a = [];
171
+ let f = !0;
172
+ function d(i, h) {
173
+ for (let s = 0; s < n.count; s++) {
174
+ const m = Math.random() * Math.PI * 2, g = n.minSpeed + Math.random() * (n.maxSpeed - n.minSpeed);
175
+ a.push({
176
+ x: i,
177
+ y: h,
178
+ size: n.minSize + Math.random() * (n.maxSize - n.minSize),
179
+ vx: Math.cos(m) * g,
180
+ vy: Math.sin(m) * g,
181
+ alpha: 1,
182
+ decay: n.decay * (0.8 + Math.random() * 0.4),
183
+ color: n.colors[Math.floor(Math.random() * n.colors.length)],
184
+ symbol: n.symbols[Math.floor(Math.random() * n.symbols.length)]
185
+ });
186
+ }
187
+ }
188
+ const c = (i) => {
189
+ const h = e.getBoundingClientRect();
190
+ d(i.clientX - h.left, i.clientY - h.top);
191
+ }, r = (i) => {
192
+ const h = e.getBoundingClientRect();
193
+ Array.from(i.changedTouches).forEach((s) => d(s.clientX - h.left, s.clientY - h.top));
194
+ };
195
+ window.addEventListener("click", c), window.addEventListener("touchend", r, { passive: !0 });
196
+ function t() {
197
+ if (f) {
198
+ o.clearRect(0, 0, e.width, e.height);
199
+ for (let i = a.length - 1; i >= 0; i--) {
200
+ const h = a[i];
201
+ h.x += h.vx, h.y += h.vy, h.vy += n.gravity, h.alpha -= h.decay, D(o, h.symbol, h.x, h.y, h.size, h.color, h.alpha, n.glow), h.alpha <= 0 && a.splice(i, 1);
202
+ }
203
+ requestAnimationFrame(t);
204
+ }
205
+ }
206
+ return t(), function() {
207
+ f = !1, window.removeEventListener("click", c), window.removeEventListener("touchend", r), o.clearRect(0, 0, e.width, e.height);
208
+ };
209
+ }
210
+ const I = {
211
+ count: 80,
212
+ // number of sparkles alive at once
213
+ minSize: 2,
214
+ maxSize: 6,
215
+ speed: 0.5,
216
+ twinkleSpeed: 0.04,
217
+ colors: ["#fff", "#ffe4e8", "#ffb3c1", "#ff85a1", "#ffd6ff", "#e7c6ff"],
218
+ glow: !0
219
+ };
220
+ function k(e, l = {}) {
221
+ const n = u(I, l), o = e.getContext("2d"), a = [];
222
+ let f = !0;
223
+ function d() {
224
+ return {
225
+ x: Math.random() * e.width,
226
+ y: Math.random() * e.height,
227
+ size: n.minSize + Math.random() * (n.maxSize - n.minSize),
228
+ alpha: Math.random(),
229
+ alphaDir: Math.random() > 0.5 ? 1 : -1,
230
+ twinkleSpeed: n.twinkleSpeed * (0.5 + Math.random()),
231
+ color: n.colors[Math.floor(Math.random() * n.colors.length)],
232
+ vx: (Math.random() - 0.5) * n.speed,
233
+ vy: (Math.random() - 0.5) * n.speed
234
+ };
235
+ }
236
+ for (let t = 0; t < n.count; t++) a.push(d());
237
+ function c(t) {
238
+ o.save(), o.globalAlpha = Math.max(0, Math.min(1, t.alpha)), n.glow && (o.shadowColor = t.color, o.shadowBlur = t.size * 3), o.fillStyle = t.color;
239
+ const i = t.size;
240
+ o.beginPath();
241
+ for (let h = 0; h < 4; h++) {
242
+ const s = h * Math.PI / 2;
243
+ o.ellipse(
244
+ t.x + Math.cos(s) * i * 0.35,
245
+ t.y + Math.sin(s) * i * 0.35,
246
+ i * 0.15,
247
+ i * 0.7,
248
+ s,
249
+ 0,
250
+ Math.PI * 2
251
+ );
252
+ }
253
+ o.fill(), o.beginPath(), o.arc(t.x, t.y, i * 0.2, 0, Math.PI * 2), o.fill(), o.restore();
254
+ }
255
+ function r() {
256
+ if (f) {
257
+ o.clearRect(0, 0, e.width, e.height);
258
+ for (let t = 0; t < a.length; t++) {
259
+ const i = a[t];
260
+ i.x += i.vx, i.y += i.vy, i.alpha += i.alphaDir * i.twinkleSpeed, i.alpha >= 1 ? (i.alpha = 1, i.alphaDir = -1) : i.alpha <= 0 && (i.alpha = 0, i.alphaDir = 1), i.x < -10 && (i.x = e.width + 10), i.x > e.width + 10 && (i.x = -10), i.y < -10 && (i.y = e.height + 10), i.y > e.height + 10 && (i.y = -10), c(i);
261
+ }
262
+ requestAnimationFrame(r);
263
+ }
264
+ }
265
+ return r(), function() {
266
+ f = !1, o.clearRect(0, 0, e.width, e.height);
267
+ };
268
+ }
269
+ const L = {
270
+ density: 0.15,
271
+ // probability of a new drop per frame
272
+ symbols: ["❤", "💕", "✨", "💖", "💗", "⭐", "×"],
273
+ minSize: 12,
274
+ maxSize: 28,
275
+ minSpeed: 1,
276
+ maxSpeed: 3.5,
277
+ colors: ["#ff6b8a", "#ff4d6d", "#ffc2d1", "#ff85a1", "#ff0a54", "#a2d2ff"],
278
+ opacity: 0.85,
279
+ glow: !0
280
+ };
281
+ function E(e, l = {}) {
282
+ const n = u(L, l), o = e.getContext("2d"), a = [];
283
+ let f = !0;
284
+ function d() {
285
+ const r = n.minSize + Math.random() * (n.maxSize - n.minSize);
286
+ return {
287
+ x: Math.random() * e.width,
288
+ y: -r * 2,
289
+ size: r,
290
+ speed: n.minSpeed + Math.random() * (n.maxSpeed - n.minSpeed),
291
+ symbol: n.symbols[Math.floor(Math.random() * n.symbols.length)],
292
+ color: n.colors[Math.floor(Math.random() * n.colors.length)],
293
+ alpha: 0.4 + Math.random() * 0.6,
294
+ angle: (Math.random() - 0.5) * 0.4,
295
+ // slight tilt
296
+ wobble: Math.random() * Math.PI * 2,
297
+ wobbleSpeed: 0.02 + Math.random() * 0.02
298
+ };
299
+ }
300
+ function c() {
301
+ if (f) {
302
+ o.clearRect(0, 0, e.width, e.height), Math.random() < n.density && a.push(d());
303
+ for (let r = a.length - 1; r >= 0; r--) {
304
+ const t = a[r];
305
+ t.y += t.speed, t.wobble += t.wobbleSpeed;
306
+ const i = Math.sin(t.wobble) * t.size * 0.3;
307
+ o.save(), o.globalAlpha = t.alpha * n.opacity, o.font = `${t.size}px serif`, o.fillStyle = t.color, n.glow && (o.shadowColor = t.color, o.shadowBlur = t.size * 0.8), o.translate(t.x + i, t.y), o.rotate(t.angle), o.fillText(t.symbol, 0, 0), o.restore(), t.y > e.height + t.size * 2 && a.splice(r, 1);
308
+ }
309
+ requestAnimationFrame(c);
310
+ }
311
+ }
312
+ return c(), function() {
313
+ f = !1, o.clearRect(0, 0, e.width, e.height);
314
+ };
315
+ }
316
+ const B = {
317
+ density: 0.18,
318
+ colors: ["#ff6b8a", "#ff4d6d", "#ffd6ff", "#e7c6ff", "#c77dff", "#48cae4", "#ffe66d", "#06d6a0"],
319
+ minSize: 6,
320
+ maxSize: 14,
321
+ minSpeed: 1.5,
322
+ maxSpeed: 4,
323
+ gravity: 0.06,
324
+ drag: 0.99,
325
+ shapes: ["rect", "circle", "ribbon"]
326
+ };
327
+ function O(e, l = {}) {
328
+ const n = u(B, l), o = e.getContext("2d"), a = [];
329
+ let f = !0;
330
+ function d() {
331
+ const t = n.minSize + Math.random() * (n.maxSize - n.minSize), i = n.minSpeed + Math.random() * (n.maxSpeed - n.minSpeed);
332
+ return {
333
+ x: Math.random() * e.width,
334
+ y: -t * 2,
335
+ w: t,
336
+ h: t * (0.4 + Math.random() * 0.8),
337
+ vx: (Math.random() - 0.5) * 3,
338
+ vy: i,
339
+ angle: Math.random() * Math.PI * 2,
340
+ spin: (Math.random() - 0.5) * 0.15,
341
+ color: n.colors[Math.floor(Math.random() * n.colors.length)],
342
+ alpha: 0.8 + Math.random() * 0.2,
343
+ shape: n.shapes[Math.floor(Math.random() * n.shapes.length)]
344
+ };
345
+ }
346
+ function c(t) {
347
+ o.save(), o.globalAlpha = t.alpha, o.fillStyle = t.color, o.strokeStyle = t.color, o.translate(t.x, t.y), o.rotate(t.angle), t.shape === "circle" ? (o.beginPath(), o.ellipse(0, 0, t.w / 2, t.h / 2, 0, 0, Math.PI * 2), o.fill()) : t.shape === "ribbon" ? (o.beginPath(), o.moveTo(-t.w / 2, 0), o.quadraticCurveTo(0, -t.h, t.w / 2, 0), o.quadraticCurveTo(0, t.h, -t.w / 2, 0), o.fill()) : o.fillRect(-t.w / 2, -t.h / 2, t.w, t.h), o.restore();
348
+ }
349
+ function r() {
350
+ if (f) {
351
+ o.clearRect(0, 0, e.width, e.height), Math.random() < n.density && a.push(d());
352
+ for (let t = a.length - 1; t >= 0; t--) {
353
+ const i = a[t];
354
+ i.vy += n.gravity, i.vx *= n.drag, i.vy *= n.drag, i.x += i.vx, i.y += i.vy, i.angle += i.spin, c(i), i.y > e.height + 20 && a.splice(t, 1);
355
+ }
356
+ requestAnimationFrame(r);
357
+ }
358
+ }
359
+ return r(), function() {
360
+ f = !1, o.clearRect(0, 0, e.width, e.height);
361
+ };
362
+ }
363
+ const q = {
364
+ interval: 1200,
365
+ // ms between auto-launches
366
+ trailLength: 28,
367
+ particleCount: 80,
368
+ colors: ["#ff6b8a", "#ff4d6d", "#ffd6ff", "#e7c6ff", "#ffe66d", "#06d6a0", "#48cae4", "#ffffff"],
369
+ gravity: 0.09,
370
+ decay: 0.014,
371
+ glow: !0
372
+ };
373
+ function v(e, l = {}) {
374
+ const n = u(q, l), o = e.getContext("2d");
375
+ let a = !0;
376
+ const f = [], d = [];
377
+ function c() {
378
+ const h = e.width * (0.2 + Math.random() * 0.6), s = e.height * (0.1 + Math.random() * 0.4);
379
+ s - e.height;
380
+ const m = 8 + Math.random() * 5, g = n.colors[Math.floor(Math.random() * n.colors.length)];
381
+ f.push({ x: h, y: e.height, vy: -Math.abs(m), targetY: s, trail: [], color: g });
382
+ }
383
+ function r(h, s, m) {
384
+ for (let g = 0; g < n.particleCount; g++) {
385
+ const w = Math.random() * Math.PI * 2, S = 1 + Math.random() * 5;
386
+ d.push({
387
+ x: h,
388
+ y: s,
389
+ vx: Math.cos(w) * S,
390
+ vy: Math.sin(w) * S,
391
+ alpha: 1,
392
+ decay: n.decay * (0.7 + Math.random() * 0.6),
393
+ size: 2 + Math.random() * 3,
394
+ color: m
395
+ });
396
+ }
397
+ }
398
+ const t = setInterval(() => {
399
+ a && c();
400
+ }, n.interval);
401
+ c();
402
+ function i() {
403
+ if (a) {
404
+ o.clearRect(0, 0, e.width, e.height);
405
+ for (let h = f.length - 1; h >= 0; h--) {
406
+ const s = f[h];
407
+ s.y += s.vy, s.trail.push({ x: s.x, y: s.y }), s.trail.length > n.trailLength && s.trail.shift();
408
+ for (let m = 0; m < s.trail.length; m++) {
409
+ const g = m / s.trail.length * 0.8;
410
+ o.save(), o.globalAlpha = g, n.glow && (o.shadowColor = s.color, o.shadowBlur = 6), o.fillStyle = s.color, o.beginPath(), o.arc(s.trail[m].x, s.trail[m].y, 2.5 * (m / s.trail.length), 0, Math.PI * 2), o.fill(), o.restore();
411
+ }
412
+ s.y <= s.targetY && (r(s.x, s.y, s.color), f.splice(h, 1));
413
+ }
414
+ for (let h = d.length - 1; h >= 0; h--) {
415
+ const s = d[h];
416
+ s.x += s.vx, s.y += s.vy, s.vy += n.gravity, s.alpha -= s.decay, o.save(), o.globalAlpha = Math.max(0, s.alpha), n.glow && (o.shadowColor = s.color, o.shadowBlur = s.size * 2), o.fillStyle = s.color, o.beginPath(), o.arc(s.x, s.y, s.size, 0, Math.PI * 2), o.fill(), o.restore(), s.alpha <= 0 && d.splice(h, 1);
417
+ }
418
+ requestAnimationFrame(i);
419
+ }
420
+ }
421
+ return i(), function() {
422
+ a = !1, clearInterval(t), o.clearRect(0, 0, e.width, e.height);
423
+ };
424
+ }
425
+ const $ = {
426
+ starCount: 120,
427
+ speed: 0.4,
428
+ colors: ["#ffffff", "#ffe4e8", "#ffc2d1", "#e7c6ff", "#a2d2ff"],
429
+ minSize: 1,
430
+ maxSize: 3.5,
431
+ twinkle: !0,
432
+ connectDist: 100,
433
+ // draw faint lines between close stars
434
+ connectOpacity: 0.08
435
+ };
436
+ function U(e, l = {}) {
437
+ const n = u($, l), o = e.getContext("2d"), a = [];
438
+ let f = !0;
439
+ function d(r = !1) {
440
+ return {
441
+ x: Math.random() * e.width,
442
+ y: Math.random() * e.height,
443
+ size: n.minSize + Math.random() * (n.maxSize - n.minSize),
444
+ alpha: 0.3 + Math.random() * 0.7,
445
+ alphaDir: Math.random() > 0.5 ? 1 : -1,
446
+ twinkleSpeed: 8e-3 + Math.random() * 0.015,
447
+ vx: (Math.random() - 0.5) * n.speed,
448
+ vy: (Math.random() - 0.5) * n.speed,
449
+ color: n.colors[Math.floor(Math.random() * n.colors.length)]
450
+ };
451
+ }
452
+ for (let r = 0; r < n.starCount; r++) a.push(d(!0));
453
+ function c() {
454
+ if (f) {
455
+ if (o.clearRect(0, 0, e.width, e.height), n.connectDist > 0)
456
+ for (let r = 0; r < a.length; r++)
457
+ for (let t = r + 1; t < a.length; t++) {
458
+ const i = a[r].x - a[t].x, h = a[r].y - a[t].y, s = Math.sqrt(i * i + h * h);
459
+ s < n.connectDist && (o.save(), o.globalAlpha = n.connectOpacity * (1 - s / n.connectDist), o.strokeStyle = "#ffffff", o.lineWidth = 0.5, o.beginPath(), o.moveTo(a[r].x, a[r].y), o.lineTo(a[t].x, a[t].y), o.stroke(), o.restore());
460
+ }
461
+ for (let r = 0; r < a.length; r++) {
462
+ const t = a[r];
463
+ t.x += t.vx, t.y += t.vy, n.twinkle && (t.alpha += t.alphaDir * t.twinkleSpeed, t.alpha >= 1 && (t.alpha = 1, t.alphaDir = -1), t.alpha <= 0.1 && (t.alpha = 0.1, t.alphaDir = 1)), t.x < -5 && (t.x = e.width + 5), t.x > e.width + 5 && (t.x = -5), t.y < -5 && (t.y = e.height + 5), t.y > e.height + 5 && (t.y = -5), o.save(), o.globalAlpha = t.alpha, o.shadowColor = t.color, o.shadowBlur = t.size * 3, o.fillStyle = t.color, o.beginPath(), o.arc(t.x, t.y, t.size, 0, Math.PI * 2), o.fill(), o.restore();
464
+ }
465
+ requestAnimationFrame(c);
466
+ }
467
+ }
468
+ return c(), function() {
469
+ f = !1, o.clearRect(0, 0, e.width, e.height);
470
+ };
471
+ }
472
+ const Y = {
473
+ density: 0.05,
474
+ // Spawn probability per frame
475
+ colors: ["#c77dff", "#ff85a1", "#ffc2d1", "#48cae4", "#e7c6ff", "#fbb1bd"],
476
+ minSize: 10,
477
+ maxSize: 22,
478
+ minSpeed: 0.8,
479
+ maxSpeed: 2.2,
480
+ glow: !0
481
+ };
482
+ function H(e, l = {}) {
483
+ const n = u(Y, l), o = e.getContext("2d"), a = [];
484
+ let f = !0, d = 0;
485
+ function c() {
486
+ const t = n.minSize + Math.random() * (n.maxSize - n.minSize);
487
+ return {
488
+ x: -t * 2,
489
+ y: e.height * 0.1 + Math.random() * (e.height * 0.8),
490
+ size: t,
491
+ speed: n.minSpeed + Math.random() * (n.maxSpeed - n.minSpeed),
492
+ color: n.colors[Math.floor(Math.random() * n.colors.length)],
493
+ alpha: 0,
494
+ flapSpeed: 0.1 + Math.random() * 0.15,
495
+ flapOffset: Math.random() * Math.PI * 2,
496
+ wobbleSpeed: 0.01 + Math.random() * 0.02,
497
+ wobbleOffset: Math.random() * Math.PI * 2
498
+ };
499
+ }
500
+ function r() {
501
+ if (f) {
502
+ d++, o.clearRect(0, 0, e.width, e.height), Math.random() < n.density && a.push(c());
503
+ for (let t = a.length - 1; t >= 0; t--) {
504
+ const i = a[t];
505
+ i.x += i.speed, i.y += Math.sin(d * i.wobbleSpeed + i.wobbleOffset) * 1.5, i.alpha < 1 && i.x < e.width / 2 && (i.alpha += 0.02);
506
+ const h = Math.abs(Math.sin(d * i.flapSpeed + i.flapOffset));
507
+ o.save(), o.globalAlpha = Math.min(1, i.alpha), o.translate(i.x, i.y), o.rotate(-0.1 - h * 0.1), n.glow && (o.shadowColor = i.color, o.shadowBlur = i.size * 1.5), o.fillStyle = i.color, o.beginPath(), o.ellipse(-i.size * 0.2, 0, i.size * 0.4 * h, i.size * 0.5, 0.3, 0, Math.PI * 2), o.fill(), o.beginPath(), o.ellipse(i.size * 0.3 * h, -i.size * 0.1, i.size * 0.5 * h, i.size * 0.6, -0.2, 0, Math.PI * 2), o.fill(), o.restore(), i.x > e.width + i.size * 2 && a.splice(t, 1);
508
+ }
509
+ requestAnimationFrame(r);
510
+ }
511
+ }
512
+ return r(), function() {
513
+ f = !1, o.clearRect(0, 0, e.width, e.height);
514
+ };
515
+ }
516
+ const X = {
517
+ particleCount: 150,
518
+ minSize: 1,
519
+ maxSize: 4,
520
+ colors: ["#ffd6ff", "#e7c6ff", "#c77dff", "#ffb3c1", "#ffffff"],
521
+ speed: 0.8,
522
+ glow: !0
523
+ };
524
+ function j(e, l = {}) {
525
+ const n = u(X, l), o = e.getContext("2d"), a = [];
526
+ let f = !0, d = 0;
527
+ function c() {
528
+ return {
529
+ x: Math.random() * e.width,
530
+ y: Math.random() * e.height,
531
+ size: n.minSize + Math.random() * (n.maxSize - n.minSize),
532
+ color: n.colors[Math.floor(Math.random() * n.colors.length)],
533
+ angle: Math.random() * Math.PI * 2,
534
+ orbitRadius: 20 + Math.random() * 80,
535
+ orbitSpeed: (0.01 + Math.random() * 0.03) * (Math.random() > 0.5 ? 1 : -1),
536
+ centerX: Math.random() * e.width,
537
+ centerY: e.height + 50,
538
+ // Start below and move up
539
+ upwardSpeed: n.speed + Math.random() * 1.5,
540
+ alpha: 0
541
+ };
542
+ }
543
+ for (let t = 0; t < n.particleCount; t++)
544
+ a.push(c()), a[t].centerY = Math.random() * e.height, a[t].alpha = Math.random();
545
+ function r() {
546
+ if (f) {
547
+ d++, o.clearRect(0, 0, e.width, e.height);
548
+ for (let t = 0; t < a.length; t++) {
549
+ const i = a[t];
550
+ i.angle += i.orbitSpeed, i.centerY -= i.upwardSpeed, i.x = i.centerX + Math.cos(i.angle) * i.orbitRadius + Math.sin(d * 0.01 + i.angle) * 30, i.y = i.centerY + Math.sin(i.angle) * (i.orbitRadius * 0.5), i.alpha < 1 && i.centerY > 0 && (i.alpha += 0.01), i.y < -50 && (Object.assign(i, c()), i.centerY = e.height + 50, i.centerX = Math.random() * e.width), o.save(), o.globalAlpha = i.alpha, n.glow && (o.shadowColor = i.color, o.shadowBlur = i.size * 3), o.fillStyle = i.color, o.beginPath(), o.arc(i.x, i.y, i.size, 0, Math.PI * 2), o.fill(), o.restore();
551
+ }
552
+ requestAnimationFrame(r);
553
+ }
554
+ }
555
+ return r(), function() {
556
+ f = !1, o.clearRect(0, 0, e.width, e.height);
557
+ };
558
+ }
559
+ const _ = {
560
+ orbCount: 15,
561
+ minSize: 50,
562
+ maxSize: 150,
563
+ colors: ["#ff4d6d", "#c77dff", "#48cae4", "#ffe66d"],
564
+ speed: 0.5,
565
+ glow: !0
566
+ };
567
+ function W(e, l = {}) {
568
+ const n = u(_, l), o = e.getContext("2d"), a = [];
569
+ let f = !0;
570
+ function d() {
571
+ const r = n.minSize + Math.random() * (n.maxSize - n.minSize);
572
+ return {
573
+ x: Math.random() * e.width,
574
+ y: Math.random() * e.height,
575
+ size: r,
576
+ vx: (Math.random() - 0.5) * n.speed,
577
+ vy: (Math.random() - 0.5) * n.speed,
578
+ color: n.colors[Math.floor(Math.random() * n.colors.length)],
579
+ alpha: 0
580
+ };
581
+ }
582
+ for (let r = 0; r < n.orbCount; r++) {
583
+ const t = d();
584
+ t.alpha = Math.random() * 0.5 + 0.1, a.push(t);
585
+ }
586
+ function c() {
587
+ if (f) {
588
+ o.clearRect(0, 0, e.width, e.height);
589
+ for (let r = 0; r < a.length; r++) {
590
+ const t = a[r];
591
+ t.x += t.vx, t.y += t.vy, t.x < -t.size && (t.x = e.width + t.size), t.x > e.width + t.size && (t.x = -t.size), t.y < -t.size && (t.y = e.height + t.size), t.y > e.height + t.size && (t.y = -t.size), o.save(), o.globalAlpha = t.alpha, o.globalCompositeOperation = "screen";
592
+ const i = o.createRadialGradient(t.x, t.y, 0, t.x, t.y, t.size);
593
+ i.addColorStop(0, t.color), i.addColorStop(1, "rgba(0,0,0,0)"), o.fillStyle = i, o.beginPath(), o.arc(t.x, t.y, t.size, 0, Math.PI * 2), o.fill(), o.restore();
594
+ }
595
+ requestAnimationFrame(c);
596
+ }
597
+ }
598
+ return c(), function() {
599
+ f = !1, o.clearRect(0, 0, e.width, e.height);
600
+ };
601
+ }
602
+ const G = {
603
+ density: 0.02,
604
+ minSpeed: 10,
605
+ maxSpeed: 25,
606
+ colors: ["#ffffff", "#e7c6ff", "#48cae4", "#ffe66d"],
607
+ glow: !0
608
+ };
609
+ function N(e, l = {}) {
610
+ const n = u(G, l), o = e.getContext("2d"), a = [];
611
+ let f = !0;
612
+ function d() {
613
+ return {
614
+ x: Math.random() * e.width * 1.5,
615
+ y: -50,
616
+ length: 50 + Math.random() * 100,
617
+ thickness: 1 + Math.random() * 2,
618
+ speed: n.minSpeed + Math.random() * (n.maxSpeed - n.minSpeed),
619
+ color: n.colors[Math.floor(Math.random() * n.colors.length)],
620
+ angle: Math.PI / 4 + (Math.random() * 0.2 - 0.1),
621
+ // Roughly 45 degrees
622
+ opacity: 1
623
+ };
624
+ }
625
+ function c() {
626
+ if (f) {
627
+ o.clearRect(0, 0, e.width, e.height), Math.random() < n.density && a.push(d());
628
+ for (let r = a.length - 1; r >= 0; r--) {
629
+ const t = a[r], i = -Math.cos(t.angle) * t.speed, h = Math.sin(t.angle) * t.speed;
630
+ t.x += i, t.y += h, t.opacity -= 0.01, o.save(), o.globalAlpha = Math.max(0, t.opacity), n.glow && (o.shadowColor = t.color, o.shadowBlur = t.thickness * 4);
631
+ const s = o.createLinearGradient(t.x, t.y, t.x - i * (t.length / t.speed), t.y - h * (t.length / t.speed));
632
+ s.addColorStop(0, t.color), s.addColorStop(1, "rgba(255,255,255,0)"), o.strokeStyle = s, o.lineWidth = t.thickness, o.lineCap = "round", o.beginPath(), o.moveTo(t.x, t.y), o.lineTo(t.x - i * (t.length / t.speed), t.y - h * (t.length / t.speed)), o.stroke(), o.restore(), (t.opacity <= 0 || t.x < -100 || t.y > e.height + 100) && a.splice(r, 1);
633
+ }
634
+ requestAnimationFrame(c);
635
+ }
636
+ }
637
+ return c(), function() {
638
+ f = !1, o.clearRect(0, 0, e.width, e.height);
639
+ };
640
+ }
641
+ const M = /* @__PURE__ */ new Map();
642
+ let J = 0;
643
+ function p(e, l, n = {}) {
644
+ const { canvas: o, destroy: a } = b(e, n), f = l(o, n), d = ++J;
645
+ return M.set(d, { destroy: a, stop: f }), d;
646
+ }
647
+ function K(e) {
648
+ if (M.has(e)) {
649
+ const l = M.get(e);
650
+ typeof l.stop == "function" && l.stop(), l.destroy(), M.delete(e);
651
+ }
652
+ }
653
+ function Q() {
654
+ M.forEach((e) => {
655
+ typeof e.stop == "function" && e.stop(), e.destroy();
656
+ }), M.clear();
657
+ }
658
+ function V(e, l = {}) {
659
+ return p(e, C, l);
660
+ }
661
+ function Z(e, l = {}) {
662
+ return p(e, T, l);
663
+ }
664
+ function tt(e, l = {}) {
665
+ return p(e, F, l);
666
+ }
667
+ function et(e, l = {}) {
668
+ return p(e, k, l);
669
+ }
670
+ function ot(e, l = {}) {
671
+ return p(e, E, l);
672
+ }
673
+ function nt(e, l = {}) {
674
+ return p(e, O, l);
675
+ }
676
+ function it(e, l = {}) {
677
+ return p(e, v, l);
678
+ }
679
+ function at(e, l = {}) {
680
+ return p(e, U, l);
681
+ }
682
+ function rt(e, l = {}) {
683
+ return p(e, H, l);
684
+ }
685
+ function lt(e, l = {}) {
686
+ return p(e, j, l);
687
+ }
688
+ function ht(e, l = {}) {
689
+ return p(e, W, l);
690
+ }
691
+ function st(e, l = {}) {
692
+ return p(e, N, l);
693
+ }
694
+ const ft = {
695
+ startFloatingHearts: V,
696
+ startHeartTrail: Z,
697
+ startHeartBurst: tt,
698
+ startSparkles: et,
699
+ startLoveRain: ot,
700
+ startConfetti: nt,
701
+ startFireworks: it,
702
+ startStarField: at,
703
+ startButterflies: rt,
704
+ startMagicDust: lt,
705
+ startFloatingOrbs: ht,
706
+ startShootingStars: st,
707
+ stopAnimation: K,
708
+ stopAll: Q
709
+ };
710
+ export {
711
+ ft as default,
712
+ rt as startButterflies,
713
+ nt as startConfetti,
714
+ it as startFireworks,
715
+ V as startFloatingHearts,
716
+ ht as startFloatingOrbs,
717
+ tt as startHeartBurst,
718
+ Z as startHeartTrail,
719
+ ot as startLoveRain,
720
+ lt as startMagicDust,
721
+ st as startShootingStars,
722
+ et as startSparkles,
723
+ at as startStarField,
724
+ Q as stopAll,
725
+ K as stopAnimation
726
+ };
727
+ //# sourceMappingURL=romantic-animations.es.js.map