Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

README

        


Circle














# 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.