https://github.com/piemonte/Twinkle
:sparkles: Twinkle interface elements in Swift
https://github.com/piemonte/Twinkle
animation caemitterlayer ios particles sparkle sparkles swift tvos twinkle
Last synced: 3 months ago
JSON representation
:sparkles: Twinkle interface elements in Swift
- Host: GitHub
- URL: https://github.com/piemonte/Twinkle
- Owner: piemonte
- License: mit
- Created: 2015-02-25T06:24:58.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2021-03-03T06:41:49.000Z (over 4 years ago)
- Last Synced: 2024-12-05T23:42:05.563Z (11 months ago)
- Topics: animation, caemitterlayer, ios, particles, sparkle, sparkles, swift, tvos, twinkle
- Language: Swift
- Homepage:
- Size: 455 KB
- Stars: 613
- Watchers: 17
- Forks: 69
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - Twinkle - Swift and easy way to make elements in your iOS and tvOS app twinkle. (UI / Animation)
- awesome-swift - Twinkle - Easy way to make elements in your iOS app twinkle. (Libs / UI)
- awesome-cocoa - Twinkle
- awesome-swift - Twinkle - Easy way to make elements in your iOS app twinkle. (Libs / UI)
- awesome-ios-star - Twinkle - Swift and easy way to make elements in your iOS and tvOS app twinkle. (UI / Animation)
- fucking-awesome-swift - Twinkle - Easy way to make elements in your iOS app twinkle. (Libs / UI)
- awesome-swift-cn - Twinkle - a Swift and easy way to make elements in your iOS app twinkle. (Libs / UI)
- Awesome-Mobile-UI - Twinkle
- awesome-swift - Twinkle - Twinkle iOS/tvOS app elements in Swift ` 📝 a year ago ` (UI [🔝](#readme))
README

## Twinkle :sparkles:
`Twinkle` is a [Swift](https://developer.apple.com/swift/) and easy way to make any UIView in your iOS or tvOS app twinkle.
This library creates several CAEmitterLayers and animates them generating a sparkle effect.
A version of Twinkle is also [available for Android](https://github.com/dev-labs-bg/twinkle).
If you like Twinkle, you may also like [Burst](https://github.com/piemonte/Burst).
[](https://travis-ci.com/piemonte/Twinkle) [](http://cocoadocs.org/docsets/Twinkle/) [](https://github.com/Carthage/Carthage) [](https://developer.apple.com/swift) [](https://github.com/piemonte/Twinkle/blob/master/LICENSE)
## Requirements
* iOS 15.0+ / tvOS 15.0+
* Xcode 15.0+
* Swift 5.9+# Quick Start
`Twinkle` is available and recommended for installation using the Cocoa dependency manager [CocoaPods](http://cocoapods.org/). You can also simply copy the `Twinkle.swift` file into your Xcode project.
```ruby
# CocoaPods
pod "Twinkle", "~> 0.6.0"# Carthage
github "piemonte/Twinkle" ~> 0.6.0# SwiftPM
let package = Package(
dependencies: [
.package(url: "https://github.com/piemonte/Twinkle", from: "0.6.0")
]
)
```## Usage
The sample project provides an example of how to integrate `Twinkle`, otherwise you can follow this example.
``` Swift
import Twinkle
`````` Swift
// Basic usage with UIView extension
let view = UIView(frame: CGRect(x: 0, y: 0, width: 150, height: 50))
self.view.addSubview(view)
view.twinkle()// With custom configuration
var config = Twinkle.Configuration()
config.minCount = 10
config.maxCount = 20
config.birthRate = 12
config.scale = 0.8
view.twinkle(configuration: config)// With custom image
let customImage = UIImage(named: "star")
view.twinkle(image: customImage)// Using the static method
Twinkle.twinkle(myView, configuration: config)
```## Community
- Found a bug? Open an [issue](https://github.com/piemonte/twinkle/issues).
- Feature idea? Open an [issue](https://github.com/piemonte/twinkle/issues).
- Want to contribute? Submit a [pull request](https://github.com/piemonte/twinkle/pulls).## Resources
* [Core Animation Reference Collection](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/CoreAnimation_framework/index.html)
* [Swift Evolution](https://github.com/apple/swift-evolution)
* [CAEmitterLayer – NSHipster](https://nshipster.com/caemitterlayer/)
* [Twinkle for Android](https://github.com/dev-labs-bg/twinkle)
* [Burst](https://github.com/piemonte/Burst)
* [Shimmer](https://github.com/facebook/shimmer)
* [Blurry](https://github.com/piemonte/Blurry)## License
Twinkle is available under the MIT license, see the [LICENSE](https://github.com/piemonte/twinkle/blob/master/LICENSE) file for more information.