Confetti
Customizable confetti view for iOS, built with Swift and UIKit. This view components allows you to easily integrate a confetti effect in your application to celebrate your user's achievements or highlight special moments in your app's user experience.
Install / Use
/learn @Kirchberg/ConfettiREADME
Confetti
<img src="https://github.com/Kirchberg/Confetti/blob/master/Media/thumb.png?raw=true" alt="Confetti Thumbnail"/>Confetti is a comprehensive and customizable confetti view for iOS, built with Swift and UIKit. The set of views allows developers to easily integrate a dynamic confetti effect into their applications, enhancing interactivity and adding a festive mood to the user experience.
Features
- Configurable Confetti Direction: The ConfettiView can emit confetti in different directions including left, right, top, and bottom.
- Customizable Emitters: Specify a list of emitter objects to control the appearance and behavior of the confetti particles.
- Animation Support: A default animation is available that applies gravity and birthrate animations to the confetti particles.
- Configuration API: Fine-tune particle count, spread, gravity, velocity, drift, scale, spin, lifetime, and more.
- Preset Configurations: Built-in presets for light, heavy, burst, gentle, fast, and slow effects.
- Reduced Motion Support: Optionally respect Reduce Motion to avoid emitting confetti.
Usage
let confetti = ConfettiView(
emitters: [
.shape(.rectangle, color: .systemYellow),
.shape(.circle, color: .systemPink),
.shape(.circle, color: .systemBlue)
],
direction: .top,
animation: .default,
configuration: .light
)
view.addSubview(confetti)
confetti.frame = view.bounds
confetti.emit()
Presets
Use the built-in presets to get a polished effect quickly:
ConfettiConfiguration.lightConfettiConfiguration.heavyConfettiConfiguration.burstConfettiConfiguration.gentleConfettiConfiguration.fastConfettiConfiguration.slow
Quick styles
Use the default emitters with a single line:
ConfettiView.topConfettiView.leftConfettiView.rightConfettiView.bottom
Notes
While the views in Confetti are easy-to-use, they also offer a high degree of flexibility, catering to most confetti-related use cases. You might wish to extend or adapt them according to your specific requirements.
Examples
Direction videos
top
https://github.com/user-attachments/assets/0a0c5556-9eb4-46e4-badb-679c427e6588
left
https://github.com/user-attachments/assets/f196fb46-d6b8-4ef4-bc9c-30bdf9aebb4d
right
https://github.com/user-attachments/assets/f35fb1bf-0cd1-467c-b9d4-207c1f092207
bottom
https://github.com/user-attachments/assets/821eb6a9-d67a-4a8d-9234-d490c3d89d8b
Preset videos
light
https://github.com/user-attachments/assets/fdc026f3-a409-480b-be31-713f599ab01d
heavy
https://github.com/user-attachments/assets/efcec2ee-499a-4e6d-b4a2-0b39655ea103
burst
https://github.com/user-attachments/assets/7a220251-0233-47a2-9133-3245fb9fbbbf
gentle
https://github.com/user-attachments/assets/ad106f1e-abcb-48e5-b48d-a842bd2715e9
fast
https://github.com/user-attachments/assets/a9e26259-3d76-45f4-83e5-1c1ab46dbf25
slow
https://github.com/user-attachments/assets/b3672f61-ec3e-4f87-a9b6-6a3e24834c2d
Star History
License
Licensed under the MIT license. See the LICENSE file for more info.
