Created
May 20, 2020 08:44
-
-
Save stevencurtis/18b0b9f7a47750d0d70c946f1fee49e4 to your computer and use it in GitHub Desktop.
animateKeyframes
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
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