{"id":13496205,"url":"https://github.com/ivanvorobei/SPConfetti","last_synced_at":"2025-03-28T18:31:38.762Z","repository":{"id":38417441,"uuid":"387173257","full_name":"ivanvorobei/SPConfetti","owner":"ivanvorobei","description":"Show the confetti only when the user is having fun, and if not having fun, don't show it.","archived":false,"fork":false,"pushed_at":"2024-04-05T08:42:45.000Z","size":6395,"stargazers_count":301,"open_issues_count":6,"forks_count":23,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-22T18:07:06.846Z","etag":null,"topics":["animation","confetti","confetti-animation","confetti-view","ios","particles","swift","swiftconfettiview","tvos","uikit","view","xcode"],"latest_commit_sha":null,"homepage":"https://opensource.ivanvorobei.io","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivanvorobei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-18T12:42:51.000Z","updated_at":"2025-03-10T07:09:05.000Z","dependencies_parsed_at":"2024-06-19T17:11:42.111Z","dependency_job_id":"7bb28fbe-451f-43a7-a130-c3dc16fd069c","html_url":"https://github.com/ivanvorobei/SPConfetti","commit_stats":{"total_commits":61,"total_committers":3,"mean_commits":"20.333333333333332","dds":"0.16393442622950816","last_synced_commit":"257a8674c62212a3919abd1f9cb31dc2fc7b0992"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanvorobei%2FSPConfetti","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanvorobei%2FSPConfetti/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanvorobei%2FSPConfetti/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanvorobei%2FSPConfetti/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanvorobei","download_url":"https://codeload.github.com/ivanvorobei/SPConfetti/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246080566,"owners_count":20720552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","confetti","confetti-animation","confetti-view","ios","particles","swift","swiftconfettiview","tvos","uikit","view","xcode"],"created_at":"2024-07-31T19:01:43.807Z","updated_at":"2025-03-28T18:31:37.382Z","avatar_url":"https://github.com/ivanvorobei.png","language":"Swift","funding_links":[],"categories":["Swift","Confetti","Content"],"sub_categories":["Content","Effects"],"readme":"# SPConfetti\n\n\u003cp aligment=\"left\"\u003e\n    \u003cimg src=\"https://cdn.ivanvorobei.io/github/spconfetti/v1.4/easy-start.png?version=2\" height=\"180\"/\u003e\n    \u003cimg src=\"https://cdn.ivanvorobei.io/github/spconfetti/v1.4/particles.png?version=2\" height=\"180\"/\u003e\n    \u003cimg src=\"https://cdn.ivanvorobei.io/github/spconfetti/v1.4/directions.png?version=2\" height=\"180\"/\u003e\n\u003c/p\u003e\n\nA 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.\n\n## Navigate\n\n- [Installation](#installation)\n    - [Swift Package Manager](#swift-package-manager)\n    - [CocoaPods](#cocoapods)\n    - [Manually](#manually)\n- [UIKit](#uikit)\n    - [Quick Start](#uikit)\n    - [Animation](#animation)\n    - [Particles](#particles)\n    - [Global Appearance](#global-appearance)\n    - [Delegate](#delegate)\n- [SwiftUI](#swiftui)\n- [Russian Community](#russian-community)\n\n## Installation\n\nReady for use on iOS 11+ and tvOS 11+.\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/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.\n\nOnce 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`.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/ivanvorobei/SPConfetti\", .upToNextMajor(from: \"1.4.0\"))\n]\n```\n\n### CocoaPods:\n\n[CocoaPods](https://cocoapods.org) is a dependency manager. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your `Podfile`:\n\n```ruby\npod 'SPConfetti'\n```\n\n### Manually\n\nIf 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`.\n\n## UIKit\n\n### Quick Start\n\nFor easy start confetti animation call this:\n\n```swift\n// For start animation\nSPConfetti.startAnimating(.centerWidthToDown, particles: [.triangle, .arc])\n\n// For stop animation\nSPConfetti.stopAnimating()\n```\n\nIf you want stop animation automatically in time, use it:\n\n```swift\nSPConfetti.startAnimating(.centerWidthToDown, particles: [.triangle, .arc], duration: 3)\n```\n\nYou can manage by view `SPConfettiView` with custom layout if need.\n\n### Animation\n\nFor change emitter size and direction, use `animation` property. Available next animations:\n\n```swift\nenum SPConfettiAnimation {\n\n    case fullWidthToDown\n    case fullWidthToUp\n    case centerWidthToDown\n    case centerWidthToUp\n}\n\n// To change animation:\nconfettiView.animation = .centerWidthToDown\n```\n\n### Particles\n\nYou can customise particles style and animation config.\n\n```swift\n// Available `.arc`, `.star`, `.heart`, `.circle`, `.triangle` and `.polygon`.\n// You can set many styles particles.\nconfettiView.particles = [.star]\n```\n\nFor set custom image use `.custom` case:\n\n```swift\nconfettiView.particles = [.custom(yourImage)]\n```\n\n### Global Appearance\n\nYou can set global values with configuration object. It will apply for all next configuration of confetti view by default.\n\n```swift\nSPConfettiConfiguration.particles = [.star]\nSPConfettiConfiguration.particlesConfig.colors = [.systemRed, .sytemBlue]\n```\n\n## Delegate\n\nFor get notification about events, set delegate for view and implement protocol `SPConfettiDelegate`: \n\n```swift\nconfettiView.delegate = self\n```\nLooks at protocol:\n\n```swift\nprotocol SPConfettiDelegate: AnyObject {\n\n    // Caling when animation start.\n    func confettiDidStartAnimating()\n\n    // Caling when animation stop.\n    func confettiDidStopAnimating()\n\n    // Caling when animation end. \n    // May calling after `confettiDidStopAnimating`,\n    // becouse after stop emitting particles existing particles\n    // still available.\n    func confettiDidEndAnimating()\n}\n```\n\n## SwiftUI\n\nIf 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.\n\n```swift\nstruct FancyButton: View {\n\n    @State private var isPresenting = false\n    \n    var body: some View {\n        Button(\"🎉 hooray!\", action: { isPresenting.toggle() })\n            .confetti(isPresented: $isPresenting,\n                      animation: .fullWidthToDown,\n                      particles: [.triangle, .arc],\n                      duration: 3.0)\n    }\n}\n```\n\nThe confetti modifier can be attached to any of the view hierarchies. It will always produce a full screen effect.\n\nThe global configuration above also works in SwiftUI. However, you can set different configurations for each confetti separately by using the `.confettiParticle(_:_:)` modifier.\n\n```swift\nVStack {\n    Button(\"Fast\", action: { isPresenting1.toggle() })\n            .confetti(isPresented: $isPresenting1,\n                      animation: .fullWidthToDown,\n                      particles: [.triangle, .arc],\n                      duration: 3.0)\n            .confettiParticle(\\.velocity, 600)\n\n    Button(\"Slow\", action: { isPresenting2.toggle() })\n            .confetti(isPresented: $isPresenting2,\n                      animation: .fullWidthToDown,\n                      particles: [.triangle, .arc],\n                      duration: 3.0)\n            .confettiParticle(\\.velocity, 100)\n}\n```\n\n## Russian Community\n\nЯ веду [телеграм-канал](https://sparrowcode.io/telegram), там публикую новости и туториалы.\u003cbr\u003e\nС проблемой помогут [в чате](https://sparrowcode.io/telegram/chat).\n\nВидео-туториалы выклыдываю на [YouTube](https://ivanvorobei.io/youtube):\n\n[![Tutorials on YouTube](https://cdn.ivanvorobei.io/github/readme/youtube-preview.jpg)](https://ivanvorobei.io/youtube)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanvorobei%2FSPConfetti","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanvorobei%2FSPConfetti","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanvorobei%2FSPConfetti/lists"}