Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func animate(_ image: UIImageView) {
- UIView.animate(withDuration: 1.0, delay: 0.0, options: [.curveLinear],
- animations: {image.center.x -= 10},
- completion: {_ in self.animate(image)})}
- func animate(_ image: UIImageView) {
- UIView.animate(withDuration: 5, delay: 0, options: .curveLinear, animations: {
- image.transform = CGAffineTransform(translationX: -100, y: 0)
- }) { (success: Bool) in
- image.transform = CGAffineTransform.identity
- animate(image)
- }
- }
- func animateBackground() {
- // Animate background
- // cityImage is the visible image
- // cityImage2 is the hidden image
- UIView.animate(withDuration: 12.0, delay: 0.0, options: [.repeat, .curveLinear], animations: {
- self.cityImage.frame = self.cityImage.frame.offsetBy(dx: -1 * self.cityImage.frame.size.width, dy: 0.0)
- self.cityImage2.frame = self.cityImage2.frame.offsetBy(dx: -1 * self.cityImage2.frame.size.width, dy: 0.0)
- }, completion: nil)
- }
Add Comment
Please, Sign In to add comment