Awesome
ConfettiKit๐
About ๐
ConfettiKit is a custom framework used to add Confetti on your iOS/iPadOS projects. The kit provides variety of customisations inorder to design a confetti which matches your project's UI. ConfettiKit makes your work of adding Confetti on your project with just one line of code.
Playground ๐ป
- I've provided a demo project to showcase few examples of Confetti's which can be made. Simply clone this repo, and open
ConfettiKit.xcworkspace
. - Run
pod install
. - Here you can see and experiment custom Loaf styles in
Examples.swift
.
Requirements โ
- Device running on iOS/iPadOS 12.1+ versions ๐ฑ.
- Swift 5.4+ ๐ป
Installation ๐
ConfettiKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ConfettiKit'
No CocoaPodsโ๏ธ
- Add this Confetti.swift file into your project.</br>
- Now you are ready to use ConfettiKit ๐.</br>
- Remaining steps are same ๐.</br>
- Do read the documentation till the end to know more about ConfettiKit ๐ช๐ผ </br>
Usage โ๏ธ
- Import Library ๐
import ConfettiKit
- Generate Confetti ๐
- Write this one line of code and add the parameters according to your specifications.
Confetti.generateConfetti(ConfettiPosition:Position, ConfettiCells:Int, ConfettiImage:[String], Colours:[UIColor], Scale:CGFloat ,BirthRate: Float, LifeTime:Float, Velocity:CGFloat, Spin:CGFloat, EmissionLongitude:CGFloat = CGFloat(Double.pi), EmissionRange:CGFloat, View: UIView)
Parameters ๐
Parameter | Definition |
---|---|
ConfettiPosition | Position from which confetti Starts |
ConfettiCells | Total types of confetti element |
ConfettiImage | Image to apply on every Cells |
Colours | Colour to apply on every Cells |
Scale | Size of cell |
BirthRate | Cells produced in a sec |
LifeTime | Total existence of a cell |
Velocity | Speed of cell |
Spin | Rotation velocity of cell |
EmissionLongitude | longitudinal orientation of the emission angle |
EmissionRange | Angle(radians), defining a cone around the emission angle |
View | View on which Confetti is to be applied |
Result ๐ฏ
Customization 1 | Customization 2 | Customization 3 |
---|---|---|
<img src="https://user-images.githubusercontent.com/56252259/125240695-1070bf00-e308-11eb-9091-bba322642216.gif" width="250" height="500"/> | <img src="https://user-images.githubusercontent.com/56252259/125241249-d5bb5680-e308-11eb-96d2-00425b13896a.gif" width="250" height="500"/> | <img src="https://user-images.githubusercontent.com/56252259/125241369-f97e9c80-e308-11eb-83a4-a1627c9949f8.gif" width="250" height="500"/> |
- Above given confettis are example project, you can cutomise it with your favourite confetti style.
How to Stop Confetti ? โ
- To stop confetti add:
Confetti.stopConfetti()
Instructions ๐ฉ
-
Images which are to be used in Confetti must be present in the
Images.xcassets
file. -
Change Rendering property of every Confetti Image to
<img src="https://user-images.githubusercontent.com/56252259/125242393-3f883000-e30a-11eb-9412-11f1e7c297d8.png" width="250" height="120"/>Template Image
from Attribute Inspector. -
While providing
ConfettiImage
&Colours
do remember total number of Images and colours must be same to the number ofConfettiCells
.
How to Contribute ๐
- Run the app - Steps are mentioned above.
- If you face issues in any step open a new issue.
- To fix issues: Fork this repository, make your changes and make a Pull Request.
License
ConfettiKit is available under the MIT license. See the LICENSE file for more info.
Like the Project ?
If you like using any of my projects or like what I'm doing, please do consider backing me with appreciating my work: Message me๐ฅฐ
OR
Drop a star โญ if you find this project interesting!
<p align="center" width="100%"> Made with โค๏ธ in ๐ฎ๐ณ By Gokul Nair </p>