ConfettiKit๐ŸŽ‰

May 9, 2022 ยท View on GitHub

ConfettiKit

ConfettiKit๐ŸŽ‰

CI Status Version Badges Platform Relative date Maintenance commit contributors Badge badge Badge Watchers

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.
  • Now you are ready to use ConfettiKit ๐Ÿš€.
  • Remaining steps are same ๐Ÿ˜.
  • Do read the documentation till the end to know more about ConfettiKit ๐Ÿ’ช๐Ÿผ

Usage โš™๏ธ

  1. Import Library ๐Ÿ“š
import ConfettiKit
  1. 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 ๐ŸŽ›

ParameterDefinition
ConfettiPositionPosition from which confetti Starts
ConfettiCellsTotal types of confetti element
ConfettiImageImage to apply on every Cells
ColoursColour to apply on every Cells
ScaleSize of cell
BirthRateCells produced in a sec
LifeTimeTotal existence of a cell
VelocitySpeed of cell
SpinRotation velocity of cell
EmissionLongitudelongitudinal orientation of the emission angle
EmissionRangeAngle(radians), defining a cone around the emission angle
ViewView on which Confetti is to be applied

Result ๐Ÿ’ฏ

Customization 1Customization 2Customization 3
  • 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 ๐Ÿšฉ

  1. Images which are to be used in Confetti must be present in the Images.xcassets file.

  2. Change Rendering property of every Confetti Image to Template Image from Attribute Inspector.

  3. While providing ConfettiImage & Colours do remember total number of Images and colours must be same to the number of ConfettiCells.

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๐Ÿฅฐ

BMC logo+wordmark - Black

OR

Drop a star โญ if you find this project interesting!

Made with โค๏ธ in ๐Ÿ‡ฎ๐Ÿ‡ณ By Gokul Nair