Created
May 20, 2020 08:10
-
-
Save stevencurtis/f6539e68c84775f008e07129a63f466a to your computer and use it in GitHub Desktop.
fullAnimationPyramid
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
class ViewController: UIViewController { | |
let subView = UIView() | |
let animateView = UIView() | |
override func loadView() { | |
subView.backgroundColor = .blue | |
self.view = subView | |
animateView.backgroundColor = .red | |
self.view.addSubview(animateView) | |
animateView.frame = CGRect(x: -self.view.frame.width - 100, y: 100, width: 100, height: 100) | |
} | |
override func viewDidAppear(_ animated: Bool) { | |
super.viewDidAppear(animated) | |
UIView.animate(withDuration: 1.0, animations: { | |
self.animateView.center = self.view.center | |
}){ _ in | |
UIView.animate(withDuration: 1.0, animations: { | |
let transformation = CGAffineTransform(rotationAngle: 45) | |
let scale = CGAffineTransform(scaleX: 1.5, y: 1.5) | |
self.animateView.transform = transformation.concatenating(scale) | |
}) | |
{ _ in | |
UIView.animate(withDuration: 1.0, 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