Created
March 15, 2017 17:25
-
-
Save agibson73/8fcade73cba972fdc153bed1f6217560 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
CATransaction.begin() | |
let animation = CABasicAnimation(keyPath: "position") | |
animation.toValue = NSValue(cgPoint: CGPoint(x: self.view.bounds.width - 100, y: self.view.bounds.height - 100)) | |
animation.fromValue = NSValue(cgPoint: position) | |
animation.duration = 5 | |
animation.isRemovedOnCompletion = false | |
animation.fillMode = kCAFillModeForwards | |
CATransaction.setCompletionBlock({ | |
self.airplane.layer.position = CGPoint(x: self.view.bounds.width - 100, y: self.view.bounds.height - 100) | |
self.airplane.image = UIImage(named: "crash") | |
}) | |
self.airplane.layer.add(animation, forKey: nil) | |
CATransaction.commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment