Last active
July 13, 2016 08:24
-
-
Save SixBe/7c22b4f50724cafdf0894c1c55c30065 to your computer and use it in GitHub Desktop.
Spinning a view with UIPropertyViewAnimator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let timing = UICubicTimingParameters(animationCurve: .easeInOut) | |
let animator = UIViewPropertyAnimator(duration: 6.0, timingParameters: timing) | |
// ball is a UIView | |
let rotationAnimation: ()->Void = { | |
ball.transform = ball.transform.rotate(CGFloat.pi) | |
} | |
for _ in 1...6 { | |
animator.addAnimations(rotationAnimation) | |
} | |
animator.startAnimation() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Medium article