Skip to content

Instantly share code, notes, and snippets.

@stevencurtis
Created May 20, 2020 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevencurtis/18b0b9f7a47750d0d70c946f1fee49e4 to your computer and use it in GitHub Desktop.
Save stevencurtis/18b0b9f7a47750d0d70c946f1fee49e4 to your computer and use it in GitHub Desktop.
animateKeyframes
UIView.animateKeyframes(withDuration: 1.0, delay: 0.0, options: [], animations: {
UIView.addKeyframe(withRelativeStartTime: 0.0, relativeDuration: 0.25, animations: {
self.animateView.center = self.view.center
})
UIView.addKeyframe(withRelativeStartTime: 0.33, relativeDuration: 0.25, animations: {
let transformation = CGAffineTransform(rotationAngle: 45)
let scale = CGAffineTransform(scaleX: 1.5, y: 1.5)
self.animateView.transform = transformation.concatenating(scale)
})
UIView.addKeyframe(withRelativeStartTime: 0.66, relativeDuration: 0.25, animations: {
self.animateView.center = CGPoint(x: self.view.frame.width + 100, y: self.animateView.frame.midY)
})
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment