12345678910111213141516171819202122232425262728293031323334353637 |
- 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)
- }
- }
|