基础动画对路径操作的动画
extension YYTransition {
func maskAnimation(targetVC: UIViewController, startPath: UIBezierPath, endPath: UIBezierPath, context: UIViewControllerContextTransitioning) {
}
下面四个文件内实现相对应的动画
YYTransition+Circle
YYTransition+Move
YYTransition+Tier
YYTransition+Middle
动画实现的思想基本就是拿到源view和目标view,控制位置和大小,做相应的动画即可。
用到的方法
UIViewControllerContextTransitioning 调用
public func viewController(forKey key: UITransitionContextViewControllerKey) -> UIViewController?
UIViewController调用
open func value(forKeyPath keyPath: String) -> Any?
* When requesting a snapshot, 'afterUpdates' defines whether the snapshot is representative of what's currently on screen or if you wish to include any recent changes before taking the snapshot.
open func snapshotView(afterScreenUpdates afterUpdates: Bool) -> UIView?
open func convert(_ rect: CGRect, from view: UIView?) -> CGRect
open func insertSubview(_ view: UIView, belowSubview siblingSubview: UIView)
// This must be called whenever a transition completes (or is cancelled.)
// Typically this is called by the object conforming to the
// UIViewControllerAnimatedTransitioning protocol that was vended by the transitioning
// delegate. For purely interactive transitions it should be called by the
// interaction controller. This method effectively updates internal view
// controller state at the end of the transition.
public func completeTransition(_ didComplete: Bool)
具体代码在YE项目地址中YYTransition动态库中
eg在YYSourceTransitionViewController和YYTargetTransitionViewController中可以看到。
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对ASPKU的支持。
注:相关教程知识阅读请移步到IOS开发频道。










