Get Updates By E-mail 

Article Written By:
Johann Dowa

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.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments