No Description

AlertAnimator.swift 996B

    // // AlertAnimator.swift // PaiAi // // Created by ffib on 2018/12/17. // Copyright © 2018 yb. All rights reserved. // import UIKit public struct AlertAnimator: PresentAnimatable { public init() {} public func contentViewAppearAnimation(duration: TimeInterval, in view: UIView) { let animation = CABasicAnimation(keyPath: "transform.scale") animation.toValue = 1 animation.fromValue = 0 animation.duration = duration animation.isRemovedOnCompletion = true view.layer.add(animation, forKey: nil) } public func contentViewDisappearAnimation(duration: TimeInterval, in view: UIView) { let animation = CAKeyframeAnimation(keyPath: "transform.scale") animation.values = [1, 1.1, 0] animation.duration = duration animation.isRemovedOnCompletion = false animation.fillMode = .forwards view.layer.add(animation, forKey: nil) } }