Skip to content

Instantly share code, notes, and snippets.

@SixBe
Last active July 13, 2016 08:24
Show Gist options
  • Save SixBe/7c22b4f50724cafdf0894c1c55c30065 to your computer and use it in GitHub Desktop.
Save SixBe/7c22b4f50724cafdf0894c1c55c30065 to your computer and use it in GitHub Desktop.
Spinning a view with UIPropertyViewAnimator
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()
@SixBe
Copy link
Author

SixBe commented Jul 13, 2016

Medium article

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment