Confetti Side Cannons
Confetti Side Cannons is a React and Tailwind CSS effect component from Magic UI, licensed MIT. Copy it and paste it into your project.
Magic UI
MIT
effects
What it is
Confetti Side Cannons is a React and Tailwind CSS effect component from Magic UI, licensed MIT. Copy it and paste it into your project.
How to use it
Open it in the catalogue, press copy, and paste it into your project. The prompt you copy carries the code and the rules that tell your agent to reproduce it without changing anything.
Five free copies a month. No card.
No packages beyond the project baseline
Licence
This component comes from Magic UI and is redistributed under the MIT licence, which permits commercial use. The copyright notice travels with the code.
Confetti Side Cannons
"use client"
import confetti from "canvas-confetti"
import { Button } from "@/components/ui/button"
export default function ConfettiSideCannons() {
const handleClick = () => {
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: colors,
})
confetti({
particleCount: 2,
angle: 120,
spread: 55,
startVelocity: 60,
origin: { x: 1, y: 0.5 },
colors: colors,
})
requestAnimationFrame(frame)
}
frame()
}
return (
<div className="relative">
<Button onClick={handleClick}>Trigger Side Cannons</Button>
</div>
)
}