Giter Club home page Giter Club logo

circle's Introduction

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:

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:

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:

imageView.crl
    .bundle(Bundle(identifier: "com.test.SomeBundle"))
    .prefix("image_")
    .from(1)
    .to(180)
    .duration(1)
    .repeatCount(3)
    .start()

All methods support call chains, so you can save reference to AnimationManager object and use it to stop animation later:

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 file for more info.

circle's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.