Skip to content

Instantly share code, notes, and snippets.

@stevencurtis
Created May 20, 2020 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevencurtis/f6539e68c84775f008e07129a63f466a to your computer and use it in GitHub Desktop.
Save stevencurtis/f6539e68c84775f008e07129a63f466a to your computer and use it in GitHub Desktop.
fullAnimationPyramid
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