mirror of
https://github.com/zen-browser/www.git
synced 2025-07-08 09:20:00 +02:00
28 lines
557 B
TypeScript
28 lines
557 B
TypeScript
import confetti from "canvas-confetti";
|
|
|
|
export const throwConfetti = () => {
|
|
const end = Date.now() + 3 * 1000; // 3 seconds
|
|
const colors = ["#a786ff", "#fd8bbc", "#eca184", "#f8deb1"];
|
|
const frame = () => {
|
|
if (Date.now() > end) return;
|
|
|
|
confetti({
|
|
particleCount: 2,
|
|
angle: 60,
|
|
spread: 55,
|
|
startVelocity: 60,
|
|
origin: { x: 0, y: 0.5 },
|
|
colors,
|
|
});
|
|
confetti({
|
|
particleCount: 2,
|
|
angle: 120,
|
|
spread: 55,
|
|
startVelocity: 60,
|
|
origin: { x: 1, y: 0.5 },
|
|
colors,
|
|
});
|
|
requestAnimationFrame(frame);
|
|
};
|
|
frame();
|
|
};
|