ANIMATION BASICS
LEARNSWIFTLA - RAGHAV MANGROLA
ANIMATION BASICS
BIRTH OF A VIEW CONTROLLER
▸ viewDidLoad
▸ viewWillAppear
▸ viewDidAppear
http://stackoverflow.com/a/5109277
ANIMATION BASICS
VIEWWILLAPPEAR
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loginButton.center.x -= view.bounds.width
}
ANIMATION BASICS
https://developer.apple.com/reference/uikit/uiview#symbols
▸ Bounds
▸ Rectangle which describes the
views location and size in it's own
coordinate system
▸ Frame
▸ Rectangle which describes the
views location and size in its
superview's coordinate system
▸ Center
▸ The center of the frame
BOUNDS AND FRAMES
ANIMATION BASICS
VIEWDIDAPPEAR
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
UIView.animate(withDuration: 5,
delay: 0,
options: [],
animations: {
self.loginButton.center.x +=
self.view.bounds.width
},
completion: nil)
}
ANIMATION BASICS
WHAT CAN WE ANIMATE?
▸ Position and Size
▸ Bounds
▸ Frame
▸ Center
▸ Appearance
▸ backgroundColor
▸ Change background color over time
▸ alpha
▸ Create fade in and fade out effects
ANIMATION BASICS
ANIMATION EASING
▸ .curveEaseIn
▸ Applies acceleration to the start of your animation
▸ .curveEaseOut
▸ Applies acceleration to the end of your animation
▸ .curveEaseInOut
▸ Applies acceleration to the start and end of your
animation

Learn swiftla animations