Dance – Swift Library For Creating Scrubbable View Animations With A Clean Syntax

Dance is an open source Swift library from Saoud Rizwan for animations utilizing UIViewPropertyAnimator for creating view animations that can even be scrubbed through using a clean straightforward syntax.

Dance includes functions allowing you to pause, start, reverse, select finished points.

This code snippet shows how to use Dance:

import Dance

class MyViewController: UIViewController {

<pre><code>let circle = UIView()

override func viewDidLoad() {
    super.viewDidLoad()

    circle.dance.animate(duration: 2.0, curve: .easeInOut) {
        $0.transform = CGAffineTransform(scaleX: 1.5, y: 1.5)
        $0.center = self.view.center
        $0.backgroundColor = .blue
        // … see ‘Animatable Properties’ for more options
    }.addCompletion { _ in
        self.view.backgroundColor = .green
    }.start(after: 5.0)
}

func pauseAnimation() {
    circle.dance.pause()
}
</code></pre>

}

You can find Dance on Github here.

A great library for animations.

Original article: Dance – Swift Library For Creating Scrubbable View Animations With A Clean Syntax

©2017 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *