A customizable, high-performance confetti animation library for SwiftUI with realistic physics and metallic effects.
Clean and elegant confetti animation perfect for any celebration moment.
Explosive burst of colorful particles for those extra special moments.
Fine-tune every aspect of the animation with the interactive settings panel.
✨ Realistic Physics - Gravity, drag, mass, and wobble effects
🎨 Customizable - Colors, sizes, shapes, and particle counts
⚡ High Performance - Optimized rendering with automatic particle cleanup
🎭 Multiple Presets - Default, Celebration, Subtle, Gold, and Rainbow
✨ Metallic Effects - Optional shimmer and gradient effects
🎯 Easy Integration - Simple SwiftUI API with sensible defaults
Add Swiftetti to your project through Xcode:
- File → Add Package Dependencies
- Enter: https://github.com/fredbenenson/Swiftetti
- Click Add Package
Or add to your Package.swift:
Available presets:
- .default - Standard confetti
- .celebration - Lots of colorful particles
- .subtle - Fewer, smaller particles
- .gold - Metallic gold theme
- .rainbow - Rainbow colors
| particleCount | Int | 150 | Number of particles per burst |
| maxTotalParticles | Int | 500 | Performance limit for concurrent particles |
| burstSpeedMin | Double | 2000 | Minimum initial velocity |
| burstSpeedMax | Double | 10000 | Maximum initial velocity |
| upwardBias | Double | 120 | Upward velocity boost |
| burstDirection | Double | 270 | Direction in degrees (270 = upward) |
| burstX | Double | 0.5 | Horizontal position (0-1, 0.5 = center) |
| burstY | Double | 400 | Vertical position in pixels from top |
| gravity | Double | 1000 | Downward acceleration |
| massMin | Double | 0.5 | Minimum particle mass |
| massMax | Double | 1.5 | Maximum particle mass |
| dragMin | Double | 0.8 | Minimum air resistance |
| dragMax | Double | 1.2 | Maximum air resistance |
| fallDurationBase | Double | 2.0 | Base fall duration in seconds |
| wobbleAmplitudeMin | Double | 5 | Minimum side-to-side movement |
| wobbleAmplitudeMax | Double | 15 | Maximum side-to-side movement |
| wobbleFrequencyMin | Double | 2 | Minimum wobble frequency |
| wobbleFrequencyMax | Double | 5 | Maximum wobble frequency |
| wobbleDecay | Double | 1.0 | Rate of wobble reduction over time |
| sizeMin | CGFloat | 2 | Minimum particle size |
| sizeMax | CGFloat | 20 | Maximum particle size |
| fadeStartPercent | Double | 0.8 | When to start fading (0-1) |
| fadeDuration | Double | 0.2 | Duration of fade animation |
| metallicEnabled | Bool | false | Enable metallic shine effects |
| metallicIntensity | Double | 0.1 | Strength of metallic effect (0-1) |
| shimmerIntensity | Double | 1.0 | Strength of shimmer animation (0-1) |
| colorPalette | [Color] | White/Silver | Array of colors to randomly select from |
The Settings panel includes a "Copy JSON" button that exports your current configuration to the clipboard as JSON. This is useful for:
- Saving custom configurations - Experiment with settings visually, then export them
- Sharing presets - Send your custom configurations to other developers
- Storing in your app - Save the JSON in your app's Resources folder for reuse
- Use the Settings panel to customize your confetti animation
- Tap "Copy JSON" to copy the configuration to clipboard
- Save the JSON to a file (e.g., Resources/MyCustomConfetti.json)
- Load it in your app:
Note: The exported JSON excludes the colorPalette property since colors aren't easily serializable. You'll need to set colors separately in code.
Important: Using more than 200 particles can cause performance issues on current iOS devices. The library allows higher counts, but be aware:
- 200+ particles: May cause frame drops and stuttering animations
- 500+ particles: Likely to cause significant lag on most devices
- Recommended: Keep particleCount under 150 for smooth performance
- Device Testing: Always test on real devices, not just simulators
- Limit maxTotalParticles: This prevents performance degradation when multiple bursts overlap
- Disable metallic effects: Turn off metallicEnabled if not needed (adds GPU overhead)
- Use smaller particle counts: For frequent triggers (e.g., game achievements)
- Consider presets: The .subtle() preset is optimized for performance
- Reduce particle size range: Smaller particles render faster
- iOS 17.0+
- Swift 5.9+
- SwiftUI
MIT License - see LICENSE file for details
Contributions are welcome! Please feel free to submit a Pull Request.
Created by Fred Benenson
[email protected]
Inspired by celebration moments everywhere 🎊
.png)



