No Description

SideAnimator.swift 708B

12345678910111213141516171819202122232425262728
  1. //
  2. // SideAnimator.swift
  3. // PaiaiUIKit
  4. //
  5. // Created by FFIB on 2019/1/24.
  6. // Copyright © 2019 FFIB. All rights reserved.
  7. //
  8. import UIKit
  9. struct SideAnimator: PresentAnimatable {
  10. func contentViewAppearAnimation(duration: TimeInterval, in view: UIView) {
  11. let animation = CATransition()
  12. animation.duration = duration
  13. animation.type = .moveIn
  14. animation.subtype = .fromLeft
  15. view.layer.add(animation, forKey: nil)
  16. }
  17. func contentViewDisappearAnimation(duration: TimeInterval, in view: UIView) {
  18. UIView.animate(withDuration: duration) {
  19. view.center = CGPoint(x: view.center.x - view.bounds.width, y: view.center.y)
  20. }
  21. }
  22. }