imzyf / ios-swift-learning-notes

📝 iOS Swift Learning Notes - see Issues
MIT License
0 stars 0 forks source link

quora dots loading animation #56

Open imzyf opened 7 years ago

imzyf commented 7 years ago
  func startAnimation() {
    dotOne.transform = CGAffineTransform(scaleX: 0.01, y: 0.01)
    dotTwo.transform = CGAffineTransform(scaleX: 0.01, y: 0.01)
    dotThree.transform = CGAffineTransform(scaleX: 0.01, y: 0.01)

    UIView.animate(withDuration: 0.6, delay: 0.0, options: [.repeat, .autoreverse], animations: {
      self.dotOne.transform = CGAffineTransform.identity
    }, completion: nil)

    UIView.animate(withDuration: 0.6, delay: 0.2, options: [.repeat, .autoreverse], animations: {
      self.dotTwo.transform = CGAffineTransform.identity
    }, completion: nil)

    UIView.animate(withDuration: 0.6, delay: 0.4, options: [.repeat, .autoreverse], animations: {
      self.dotThree.transform = CGAffineTransform.identity
    }, completion: nil)
  }
imzyf commented 7 years ago

https://github.com/soapyigu/Swift30Projects/tree/master/Project%2014%20-%20QuoraDots