|
//
// PresentAnimatable.swift
// PaiAi
//
// Created by ffib on 2018/12/17.
// Copyright © 2018 yb. All rights reserved.
//
import UIKit
public protocol PresentAnimatable {
func toViewPresentedAnimation(duration: TimeInterval, in view: UIView)
func fromViewPresentingAnimation(duration: TimeInterval, in view: UIView)
func contentViewAppearAnimation(duration: TimeInterval, in view: UIView)
func contentViewDisappearAnimation(duration: TimeInterval, in view: UIView)
}
public extension PresentAnimatable {
func toViewPresentedAnimation(duration: TimeInterval, in view: UIView) {
UIView.transition(with: view, duration: duration, options: [], animations: {
view.backgroundColor = UIColor(red: 52 / 255,
green: 52 / 255,
blue: 52 / 255,
alpha: 0.7)
})
}
func fromViewPresentingAnimation(duration: TimeInterval, in view: UIView) {
UIView.transition(with: view, duration: duration, options: [], animations: {
view.backgroundColor = UIColor(red: 52 / 255,
green: 52 / 255,
blue: 52 / 255,
alpha: 0)
})
}
}
|