aw-front-helpers 2.5.28 → 2.5.29
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/classes/credits.js +38 -1
- package/package.json +2 -1
package/classes/credits.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { gsap } from "gsap";
|
|
2
2
|
import { SplitText } from "gsap/SplitText";
|
|
3
|
+
import confetti from 'canvas-confetti';
|
|
3
4
|
|
|
4
5
|
export default class Credits {
|
|
5
6
|
constructor() {
|
|
@@ -67,7 +68,43 @@ export default class Credits {
|
|
|
67
68
|
});
|
|
68
69
|
gsap.to(wrapper, { duration: 1, opacity: 1});
|
|
69
70
|
gsap.from(split.chars, { delay: .6, duration: .3, x: 5, autoAlpha: 0, stagger: .07 });
|
|
70
|
-
wrapper.addEventListener('click', () =>
|
|
71
|
+
wrapper.addEventListener('click', () => wrapper.remove(), { once: true });
|
|
72
|
+
|
|
73
|
+
this._confetti();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_confetti() {
|
|
77
|
+
const duration = 5 * 1000;
|
|
78
|
+
const animationEnd = Date.now() + duration;
|
|
79
|
+
let skew = 1;
|
|
80
|
+
|
|
81
|
+
const randomInRange = (min, max) => Math.random() * (max - min) + min;
|
|
82
|
+
(function frame() {
|
|
83
|
+
const fallingParticles = (color, particleCount = 5) => {
|
|
84
|
+
confetti({
|
|
85
|
+
particleCount,
|
|
86
|
+
startVelocity: 0,
|
|
87
|
+
ticks,
|
|
88
|
+
origin: {
|
|
89
|
+
x: Math.random(),
|
|
90
|
+
y: (Math.random() * skew) - 0.2
|
|
91
|
+
},
|
|
92
|
+
colors: [color],
|
|
93
|
+
shapes: ['circle'],
|
|
94
|
+
gravity: randomInRange(0.4, 0.6),
|
|
95
|
+
scalar: randomInRange(0.4, 1),
|
|
96
|
+
drift: randomInRange(-0.4, 0.4)
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const timeLeft = animationEnd - Date.now();
|
|
100
|
+
const ticks = Math.max(200, 500 * (timeLeft / duration));
|
|
101
|
+
skew = Math.max(0.8, skew - 0.001);
|
|
102
|
+
fallingParticles('#b70202', 5);
|
|
103
|
+
fallingParticles('#adadd3', 1);
|
|
104
|
+
fallingParticles('#0f095b', 1);
|
|
105
|
+
|
|
106
|
+
if (timeLeft > 0) requestAnimationFrame(frame);
|
|
107
|
+
}())
|
|
71
108
|
}
|
|
72
109
|
|
|
73
110
|
_addEvents() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aw-front-helpers",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.29",
|
|
4
4
|
"description": "Assets helpers for projects",
|
|
5
5
|
"author": "Yoann Le Poupon",
|
|
6
6
|
"license": "ISC",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@googlemaps/js-api-loader": "^1.16.6",
|
|
14
|
+
"canvas-confetti": "^1.9.3",
|
|
14
15
|
"es6-symbol": "^3.1.3",
|
|
15
16
|
"exif-js": "^2.3.0",
|
|
16
17
|
"debounce": "^1.2.1",
|