Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simplisticated/circleplayer
Simplifies UIImageView animations
https://github.com/simplisticated/circleplayer
animation swift uiimage uiimageview xcode
Last synced: 4 days ago
JSON representation
Simplifies UIImageView animations
- Host: GitHub
- URL: https://github.com/simplisticated/circleplayer
- Owner: simplisticated
- License: mit
- Created: 2018-02-10T15:21:03.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-20T08:04:05.000Z (almost 7 years ago)
- Last Synced: 2024-03-15T09:22:08.388Z (11 months ago)
- Topics: animation, swift, uiimage, uiimageview, xcode
- Language: Ruby
- Size: 765 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
# Circle
Simplifies `UIImageView` animations via set of classes and extensions.
## How To Get Started
- Copy content of `Source` folder to your project.
or
- Use `CirclePlayer` cocoapod
## Requirements
* iOS 9 and later
* Xcode 9 and later
* Swift 4## Usage
Let's assume, you have set of images in your Xcode project and you'd like to use them for playing animation within `UIImageView` instance. How this could be done with normal `UIKit` approach:
```swift
imageView.animationImages = [
UIImage(named: "image_1")!,
UIImage(named: "image_2")!,
UIImage(named: "image_3")!,
UIImage(named: "image_4")!,
UIImage(named: "image_5")!,
UIImage(named: "image_6")!,
UIImage(named: "image_7")!,
UIImage(named: "image_8")!,
// etc.
]imageView.animationDuration = 1
imageView.animatedImageView.animationRepeatCount = 1000
imageView.animatedImageView.startAnimating()
```With `Circle` library you can implement the same behavior by using these lines:
```swift
imageView.crl
.prefix("image_")
.from(1)
.to(8)
.duration(1)
.repeatCount(1000)
.start()
```If images are stored in another bundle, simply mention it by using `bundle` method:
```swift
imageView.crl
.bundle(Bundle(identifier: "com.test.SomeBundle"))
.prefix("image_")
.from(1)
.to(180)
.duration(3)
.repeatCount(1000)
.start()
```All methods support call chains, so you can save reference to `AnimationManager` object and use it to stop animation later:
```swift
let animationManager = imageView.crl
.prefix("image_")
.from(1)
.to(240)
.duration(4)
.repeatCount(1000)
.start()animationManager.stop()
```## License
`Circle` is available under the MIT license. See the [LICENSE](./LICENSE) file for more info.