Last active
April 26, 2020 17:05
-
-
Save alexnikol/e5065efa9423251de47f33764a310d4a to your computer and use it in GitHub Desktop.
Combine animations
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
CATransaction.begin() //Start of animation transaction | |
CATransaction.setCompletionBlock { //Transaction is Ready | |
print("READY") | |
} | |
heightConstraint.constant = 80.0 | |
UIView.animate(withDuration: 2.0) { // UIView type of animation | |
view.layoutIfNeeded() | |
} | |
let cornerAnimation = CABasicAnimation(keyPath: #keyPath(CALayer.cornerRadius)) // CALayer type of animation | |
cornerAnimation.fromValue = 0 | |
cornerAnimation.toValue = 12 | |
view.layer.add(cornerAnimation, forKey: #keyPath(CALayer.cornerRadius)) | |
CATransaction.commit() //End of animation transaction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment