title: How to remove animation by pressing a button. Swift
body: <p>I have a button and an animation. How can I write in the function (Flower animation) that if the button is pressed, the animation hides or is removed. Any of these options will do. </p>
  
  <p>Anyone has any ideas?</p>
  
  <pre><code>@IBAction func settings(sender: UIButton) {
      settingsPlate.hidden = false
      viewTwo.hidden = false
      exit.hidden = false
  
      dimmedView.backgroundColor = UIColor(red: 0.5, green: 0.5, blue: 0.5, alpha: 1.0)
      dimmedView.alpha = 0.5
      dimmedView.hidden = false
  
  }
  </code></pre>
  
  <p>This is the Flower animation. I would like to write a code in here that says, if button is pressed go away or hide. </p>
  
  <pre><code>func animateFlowerOne(){
  
      let options = UIViewAnimationOptions.CurveEaseInOut
  
      //Flower 1 Four
      let flowers = UIImageView()
      flowers.image = UIImage(named: "flower-face")
      flowers.frame = CGRect(x: 70, y: 380, width: 0, height: 0)
      self.view.addSubview(flowers)
  
  
      UIView.animateWithDuration(500.0, delay: 200.0, options: options, animations: {
          flowers.frame = CGRect(x: 70, y: 380, width: 15, height: 15)
          }, completion: { animationFinished in
              UIView.animateWithDuration(500.0, delay: 200.0, options: options, animations: {
                  flowers.frame = CGRect(x: 70, y: 380, width: 0, height: 0)
  
                  }, completion: { animationFinished in
                      flowers.removeFromSuperview()
                      self.animateFlowerOne()
              })
      })
  }
  </code></pre>