daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Feb 20th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func animation() {
  2.         {
  3.         var imagesL = [UIImage]()
  4.         var imagesR = [UIImage]()
  5.  
  6.         for i in 0..<imagesArray.count
  7.         {
  8.             imagesT.append(UIImage(named: imagesArray[i])!)
  9.             imagesW.append(UIImage(named: imagesArray[i])!)
  10.         }
  11.         leftImageView.animationImages = imagesL
  12.         leftImageView.animationDuration = 1.19
  13.         leftImageView.animationRepeatCount = 3
  14.         leftImageView.startAnimating()
  15.  
  16.         rightImageView.animationImages = imagesR
  17.         rightImageView.animationDuration = 1.13
  18.         rightImageView.animationRepeatCount = 3
  19.         rightImageView.startAnimating()
  20. }
  21.  func resetAnimation() {
  22.             self.leftImageView.subviews.forEach({$0.layer.removeAllAnimations()})
  23.             self.rightImageView.subviews.forEach({$0.layer.removeAllAnimations()})
  24.             self.leftImageView.layer.removeAllAnimations()
  25.             self.rightImageView.layer.removeAllAnimations()
  26.             self.leftImageView.layoutIfNeeded()
  27.             self.rightImageView.layoutIfNeeded()
  28.     }
  29.  
  30.  @IBAction func playButtonPressed(_ sender: UIButton) {
  31.         resetAnimation()
  32.         animation()
  33.     }
  34.  
  35.  @IBAction func leftMonsterButtonPressed(_ sender: UIButton) {
  36.         leftImageView.stopAnimating()
  37.     }
  38.  @IBAction func rightMonsterButtonPressed(_ sender: UIButton) {
  39.         rightImageView.stopAnimating()
  40.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top