Skip to content

Instantly share code, notes, and snippets.

@cjinghong
Last active November 13, 2017 07:43
Show Gist options
  • Save cjinghong/c47e43ac846a1e3bd6cb72e677d583cf to your computer and use it in GitHub Desktop.
Save cjinghong/c47e43ac846a1e3bd6cb72e677d583cf to your computer and use it in GitHub Desktop.
let timing = UICubicTimingParameters(animationCurve: .easeOut)
// A global animator variable is already defined
animator = UIViewPropertyAnimator(duration: 2.0, timingParameters:timing)
animator.addAnimations {
square.center = CGPoint(x: 300, y: square.center.y)
square.transform = CGAffineTransform(rotationAngle: CGFloat.pi)
}
animator.startAnimation()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment