npm install --save canvas-confetti
import confetti from 'confetti';
// 以默认方式启动一些五彩纸屑:
confetti();
// 推出一堆五彩纸屑:
confetti({
particleCount: 150
});
// 推出一些非常宽的五彩纸屑:
confetti({
spread: 180
});
// 从页面的随机部分启动一小撮五彩纸屑:
confetti({
particleCount: 100,
startVelocity: 30,
spread: 360,
origin: {
x: Math.random(),
// since they fall down, start a bit higher than random
y: Math.random() - 0.2
}
});