Guest User

Untitled

a guest
Jul 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. let firstTransition: CGFloat = -52
  2. let secondTransition: CGFloat = -40
  3. UIView.animateKeyframes(withDuration: 0.8,
  4. delay: 0.7,
  5. options: UIViewKeyframeAnimationOptions(rawValue: 0),
  6. animations: {
  7. UIView.addKeyframe(withRelativeStartTime: 0,
  8. relativeDuration: 0.2,
  9. animations: {
  10. self.avatarImageView.setTransform(rotationInDegrees: -35)
  11. })
  12. UIView.addKeyframe(withRelativeStartTime: 0,
  13. relativeDuration: 0.3,
  14. animations: {
  15. self.avatarImageView.center.x += firstTransition
  16. })
  17. UIView.addKeyframe(withRelativeStartTime: 0.2,
  18. relativeDuration: 0.2,
  19. animations: {
  20. self.avatarImageView.center.x += secondTransition
  21. })
  22. UIView.addKeyframe(withRelativeStartTime: 0.4,
  23. relativeDuration: 0.2,
  24. animations: {
  25. self.avatarImageView.setTransform(rotationInDegrees: -29.5)
  26. })
  27. UIView.addKeyframe(withRelativeStartTime: 0.6,
  28. relativeDuration: 0.1,
  29. animations: {
  30. self.avatarImageView.setTransform(rotationInDegrees: -30.5)
  31. })
  32. UIView.addKeyframe(withRelativeStartTime: 0.7,
  33. relativeDuration: 0.1,
  34. animations: {
  35. self.avatarImageView.setTransform(rotationInDegrees: -30)
  36. })
  37.  
  38. }, completion: { _ in
  39. self.avatarImageView.snp.updateConstraints { (make) in
  40. make.right.equalToSuperview().offset(self.avatarImageViewWidth + firstTransition + secondTransition)
  41. }
  42. }
Add Comment
Please, Sign In to add comment