It's raining confetti. ๐
crafted with โฅ by Ishan Chhabra
Adding delight with confetti. ICConfetti
lets you rain confetti in your views. ๐
Snippet # 1: It's raining confetti in two lines of code. ๐ง
var icConfetti: ICConfetti!
override func viewDidLoad() {
super.viewDidLoad()
icConfetti = ICConfetti()
icConfetti.rain(in: self.view)
}
Snippet # 2: Don't forget to let the rain up! โ๏ธ
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
icConfetti.stopRaining()
}
Snippet # 3: Set up the visual aspect! ๐
// Customize the colors... ๐จ
icConfetti.colors = [.red, .green, .yellow, .blue]
// Tailor the confetti images. White template images work the best. ๐ผ
icConfetti.images = [
UIImage(named: "Box")!,
UIImage(named: "Circle")!,
UIImage(named: "Triangle")!,
UIImage(named: "Spiral")!
]
// Throttle the velocities... ๐
icConfetti.velocities = [100, 128, 144, 512]
ICConfetti
is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'ICConfetti'
Web: Ishan Chhabra
Twitter: @chh_abracadabra
Medium: @chh_abracadabra
ICConfetti
is available under the MIT license. See the LICENSE file for more info.