All Projects → ivanvorobei → SPConfetti

ivanvorobei / SPConfetti

Licence: MIT license
Show the confetti only when the user is having fun, and if not having fun, don't show it.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to SPConfetti

Viewcomposer
Compose views using enums swiftly: `let label: UILabel = [.text("Hello"), .textColor(.red)]`
Stars: ✭ 27 (-85.56%)
Mutual labels:  view, uikit
react-native-confetti
React Native component to show confetti
Stars: ✭ 46 (-75.4%)
Mutual labels:  confetti, confetti-animation
Tap water
【声明:未发布前,勿使用,勿star,预计2020年11月底发布】Flutter tab_bar组件,支持中间带加号按钮的TabBar,支持Lottie动画。iTeaTime(技术清谈)团队出品。Highly customizable tabBar and tabBarController for Flutter
Stars: ✭ 52 (-72.19%)
Mutual labels:  view, uikit
Swifterswift
A handy collection of more than 500 native Swift extensions to boost your productivity.
Stars: ✭ 10,706 (+5625.13%)
Mutual labels:  tvos, uikit
react-snowfetti
Generates random particles using html5 canvas API.
Stars: ✭ 17 (-90.91%)
Mutual labels:  particles, confetti
Weatherview
WeatherView is an Android Library let you make cool weather animations for your app
Stars: ✭ 426 (+127.81%)
Mutual labels:  view, particles
Instagramactivityindicator
Activity Indicator similar to Instagram's.
Stars: ✭ 138 (-26.2%)
Mutual labels:  view, uikit
Acknowlist
Acknowledgements screen displaying a list of licenses, for example from CocoaPods dependencies.
Stars: ✭ 392 (+109.63%)
Mutual labels:  tvos, uikit
SwiftCurrent
A library for managing complex workflows in Swift
Stars: ✭ 286 (+52.94%)
Mutual labels:  tvos, uikit
RFKit
Toolkit for daily Cocoa development. Since 2012.
Stars: ✭ 20 (-89.3%)
Mutual labels:  tvos, uikit
Vtacknowledgementsviewcontroller
Acknowledgements screen displaying a list of licenses, for example from CocoaPods dependencies.
Stars: ✭ 863 (+361.5%)
Mutual labels:  tvos, uikit
curry
curry is a framework built to enhance and compliment Foundation and UIKit.
Stars: ✭ 47 (-74.87%)
Mutual labels:  tvos, uikit
Swiftui
A collaborative list of awesome SwiftUI resources. Feel free to contribute!
Stars: ✭ 774 (+313.9%)
Mutual labels:  tvos, uikit
Cyltabbarcontroller
[EN]It is an iOS UI module library for adding animation to iOS tabbar items and icons with Lottie, and adding a bigger center UITabBar Item. [CN]【中国特色 TabBar】一行代码实现 Lottie 动画TabBar,支持中间带+号的TabBar样式,自带红点角标,支持动态刷新。【iOS13 & Dark Mode & iPhone XS MAX supported】
Stars: ✭ 6,605 (+3432.09%)
Mutual labels:  view, uikit
Twinkle
✨ Twinkle iOS/tvOS app elements in Swift
Stars: ✭ 569 (+204.28%)
Mutual labels:  tvos, particles
Kvconstraintkit
An Impressive Auto Layout DSL for iOS, tvOS & OSX. & It is written in pure swift.
Stars: ✭ 91 (-51.34%)
Mutual labels:  view, tvos
Invalidating
Backports the new @invalidating property wrapper to older platforms
Stars: ✭ 53 (-71.66%)
Mutual labels:  tvos, uikit
WebPKit
A framework that extends a variety of Cocoa APIs with capabilities for encoding and decoding WebP files for all of Apple's platforms.
Stars: ✭ 29 (-84.49%)
Mutual labels:  tvos, uikit
AndroidUiKit
uikit widget common baseview Adapter faster develop
Stars: ✭ 48 (-74.33%)
Mutual labels:  view, uikit
Driftwood
Driftwood is a DSL to make Auto Layout easy on iOS, tvOS and macOS.
Stars: ✭ 14 (-92.51%)
Mutual labels:  tvos, uikit

SPConfetti

A simple solution to show the confetti to the user. Smoothly starts and stops. Allow set multiply diffrent particles at once. You can change shapes and switch between styles. It is possible to change the size and position of emitter. Ready use arc, star, heart triangle shapes. You can set custom shapes with your image.

Navigate

Installation

Ready for use on iOS 11+ and tvOS 11+.

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

Once you have your Swift package set up, adding as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/ivanvorobei/SPConfetti", .upToNextMajor(from: "1.4.0"))
]

CocoaPods:

CocoaPods is a dependency manager. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your Podfile:

pod 'SPConfetti'

Manually

If you prefer not to use any of dependency managers, you can integrate manually. Put Sources/SPConfetti folder in your Xcode project. Make sure to enable Copy items if needed and Create groups.

UIKit

Quick Start

For easy start confetti animation call this:

// For start animation
SPConfetti.startAnimating(.centerWidthToDown, particles: [.triangle, .arc])

// For stop animation
SPConfetti.stopAnimating()

If you want stop animation automatically in time, use it:

SPConfetti.startAnimating(.centerWidthToDown, particles: [.triangle, .arc], duration: 3)

You can manage by view SPConfettiView with custom layout if need.

Animation

For change emitter size and direction, use animation property. Available next animations:

enum SPConfettiAnimation {

    case fullWidthToDown
    case fullWidthToUp
    case centerWidthToDown
    case centerWidthToUp
}

// To change animation:
confettiView.animation = .centerWidthToDown

Particles

You can customise particles style and animation config.

// Available `.arc`, `.star`, `.heart`, `.circle`, `.triangle` and `.polygon`.
// You can set many styles particles.
confettiView.particles = [.star]

For set custom image use .custom case:

confettiView.particles = [.custom(yourImage)]

Global Appearance

You can set global values with configuration object. It will apply for all next configuration of confetti view by default.

SPConfettiConfiguration.particles = [.star]
SPConfettiConfiguration.particlesConfig.colors = [.systemRed, .sytemBlue]

Delegate

For get notification about events, set delegate for view and implement protocol SPConfettiDelegate:

confettiView.delegate = self

Looks at protocol:

protocol SPConfettiDelegate: AnyObject {

    // Caling when animation start.
    func confettiDidStartAnimating()

    // Caling when animation stop.
    func confettiDidStopAnimating()

    // Caling when animation end. 
    // May calling after `confettiDidStopAnimating`,
    // becouse after stop emitting particles existing particles
    // still available.
    func confettiDidEndAnimating()
}

SwiftUI

If you are using SwiftUI, it is recommended that you use the modifier we provide. This will ensure the confetti effects are presented within the corresponding window scene.

struct FancyButton: View {

    @State private var isPresenting = false
    
    var body: some View {
        Button("🎉 hooray!", action: { isPresenting.toggle() })
            .confetti(isPresented: $isPresenting,
                      animation: .fullWidthToDown,
                      particles: [.triangle, .arc],
                      duration: 3.0)
    }
}

The confetti modifier can be attached to any of the view hierarchies. It will always produce a full screen effect.

The global configuration above also works in SwiftUI. However, you can set different configurations for each confetti separately by using the .confettiParticle(_:_:) modifier.

VStack {
    Button("Fast", action: { isPresenting1.toggle() })
            .confetti(isPresented: $isPresenting1,
                      animation: .fullWidthToDown,
                      particles: [.triangle, .arc],
                      duration: 3.0)
            .confettiParticle(\.velocity, 600)

    Button("Slow", action: { isPresenting2.toggle() })
            .confetti(isPresented: $isPresenting2,
                      animation: .fullWidthToDown,
                      particles: [.triangle, .arc],
                      duration: 3.0)
            .confettiParticle(\.velocity, 100)
}

Russian Community

Я веду телеграм-канал, там публикую новости и туториалы.
С проблемой помогут в чате.

Видео-туториалы выклыдываю на YouTube:

Tutorials on YouTube

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].