Skip to content

Instantly share code, notes, and snippets.

@stevencurtis
Created July 16, 2020 10:19
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/a97e3fd088a249947266dbfde2da6f86 to your computer and use it in GitHub Desktop.
Save stevencurtis/a97e3fd088a249947266dbfde2da6f86 to your computer and use it in GitHub Desktop.
animateconstraints
func animate() {
UIView.animate(withDuration: 0.5, delay: 0.5, options: [.curveEaseOut], animations: {
self.tree0.alpha = 1.0
self.city.alpha = 1.0
self.city2.alpha = 1.0
self.manImage.alpha = 1.0
}, completion: nil)
UIView.animate(withDuration: 8.0, delay: 0.0, options: [.repeat, .curveLinear], animations: {
self.city.frame = self.city.frame.offsetBy(dx: -1 * self.city.frame.size.width, dy: 0.0)
self.city2.frame = self.city2.frame.offsetBy(dx: -1 * self.city2.frame.size.width, dy: 0.0)
self.tree0.frame = self.tree0.frame.offsetBy(dx: -1 * self.city2.frame.size.width * 2, dy: 0.0)
}, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment