Guest User

Untitled

a guest
Jul 20th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. func animate(_ image: UIImageView) {
  2. UIView.animate(withDuration: 1.0, delay: 0.0, options: [.curveLinear],
  3. animations: {image.center.x -= 10},
  4. completion: {_ in self.animate(image)})}
  5.  
  6. func animate(_ image: UIImageView) {
  7. UIView.animate(withDuration: 5, delay: 0, options: .curveLinear, animations: {
  8. image.transform = CGAffineTransform(translationX: -100, y: 0)
  9. }) { (success: Bool) in
  10. image.transform = CGAffineTransform.identity
  11. animate(image)
  12. }
  13. }
  14.  
  15. func animateBackground() {
  16.  
  17. // Animate background
  18. // cityImage is the visible image
  19. // cityImage2 is the hidden image
  20.  
  21. UIView.animate(withDuration: 12.0, delay: 0.0, options: [.repeat, .curveLinear], animations: {
  22. self.cityImage.frame = self.cityImage.frame.offsetBy(dx: -1 * self.cityImage.frame.size.width, dy: 0.0)
  23. self.cityImage2.frame = self.cityImage2.frame.offsetBy(dx: -1 * self.cityImage2.frame.size.width, dy: 0.0)
  24. }, completion: nil)
  25.  
  26. }
Add Comment
Please, Sign In to add comment