Latest 0.3.0
Homepage https://github.com/hlfcoding/Anime
License MIT
Platforms ios 10.0
Frameworks UIKit
Authors

Version
License
Platform
Code Climate

:film_strip:   UIView animation from the Far East.

anime

Example

let a = Animation(of: { view.frame.origin.x += 10 }, duration: 1)
let b = a.with(animations: { view.frame.origin.x -= 10 })
let timeline = AnimationTimeline(a, b, b, a).start() { (finished) in
  guard finished else {
    // ...
    return
  }
  print("done")
}
// ...
timeline.needsToCancel = true

Compare the above 10 lines with the below 30 lines:

var isCancelled = false
let handleCancelled = {
  // ...
}
let a = { view.frame.origin.x += 10 }
let b = { view.frame.origin.x -= 10 }
let start = {
  UIView.animate(withDuration: 1, animations: a) { _ in
    if isCancelled {
      handleCancelled()
      return
    }
    UIView.animate(withDuration: 1, animations: b) { _ in
      if isCancelled {
        handleCancelled()
        return
      }
      UIView.animate(withDuration: 1, animations: b) { _ in
        if isCancelled {
          handleCancelled()
          return
        }
        UIView.animate(withDuration: 1, animations: a) { _ in
          print("done")
        }
      }
    }
  }
}
start()
// ...
isCancelled = true

Animations can also be configured more flexibly, and appended in-flight:

var z = b
z.animations = { /* ... */ }
z.type = .keyframed(options: [])
// ...
timeline.append(z)

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Swift 4+

Installation

Anime is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "Anime"

Author

Peng Wang, [email protected]

License

Anime is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Anime",
    "version": "0.3.0",
    "summary": "UIView animation from the Far East.",
    "description": "Simple UIView animation library, but not any simpler.",
    "homepage": "https://github.com/hlfcoding/Anime",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Peng Wang": "[email protected]"
    },
    "source": {
        "git": "https://github.com/hlfcoding/Anime.git",
        "tag": "0.3.0"
    },
    "social_media_url": "https://twitter.com/hlfcoding",
    "swift_version": "4.2",
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "Anime/Classes/**/*",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This