Created
December 20, 2017 08:12
-
-
Save dejanskledar/31e7865215f336b7543784939ddbdb3e to your computer and use it in GitHub Desktop.
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: 5.0, delay: 0, options: [.calculationModeCubic], animations: { | |
// Add animations | |
UIView.addKeyframe(withRelativeStartTime: 0, relativeDuration: 1.0/5.0, animations: { | |
view.frame.origin.x += 200 | |
}) | |
UIView.addKeyframe(withRelativeStartTime: 1.0/5.0, relativeDuration: 1.0/5.0, animations: { | |
view.backgroundColor = .green | |
}) | |
UIView.addKeyframe(withRelativeStartTime: 2.0/5.0, relativeDuration: 1.0/5.0, animations: { | |
view.frame.origin.y += 200 | |
}) | |
UIView.addKeyframe(withRelativeStartTime: 3.0/5.0, relativeDuration: 1.0/5.0, animations: { | |
view.transform = CGAffineTransform.identity.scaledBy(x: 2, y: 2) | |
}) | |
UIView.addKeyframe(withRelativeStartTime: 4.0/5.0, relativeDuration: 1.0/5.0, animations: { | |
view.alpha = 0 | |
}) | |
}, completion:{ _ in | |
print("I'm done!") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment