Commit 3d538a63 by Daniel Dahan

development: updated transform behaviour when setting up MotionTransition

parent c7200fdf
...@@ -84,17 +84,17 @@ extension UIViewController { ...@@ -84,17 +84,17 @@ extension UIViewController {
} }
} }
//extension UIViewController { extension UIViewController {
// open func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { open func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
// return isMotionTransitionEnabled ? MotionTransition(isPresenting: operation == .push) : nil return isMotionTransitionEnabled ? MotionTransition(isPresenting: operation == .push) : nil
// } }
//} }
//
//extension UIViewController { extension UIViewController {
// open func tabBarController(_ tabBarController: UITabBarController, animationControllerForTransitionFrom fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { open func tabBarController(_ tabBarController: UITabBarController, animationControllerForTransitionFrom fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
// return isMotionTransitionEnabled ? MotionTransition() : nil return isMotionTransitionEnabled ? MotionTransition() : nil
// } }
//} }
extension UIView { extension UIView {
/// The global position of a view. /// The global position of a view.
...@@ -143,11 +143,13 @@ extension UIView { ...@@ -143,11 +143,13 @@ extension UIView {
let oldBackgroundColor = backgroundColor let oldBackgroundColor = backgroundColor
backgroundColor = .clear backgroundColor = .clear
let oldTransform = transform
transform = .identity
let v = snapshotView(afterScreenUpdates: afterUpdates)! let v = snapshotView(afterScreenUpdates: afterUpdates)!
cornerRadius = oldCornerRadius cornerRadius = oldCornerRadius
backgroundColor = oldBackgroundColor backgroundColor = oldBackgroundColor
v.backgroundColor = oldBackgroundColor transform = oldTransform
let contentView = v.subviews.first! let contentView = v.subviews.first!
contentView.cornerRadius = cornerRadius contentView.cornerRadius = cornerRadius
...@@ -169,7 +171,10 @@ extension UIView { ...@@ -169,7 +171,10 @@ extension UIView {
v.shadowColor = shadowColor v.shadowColor = shadowColor
v.shadowOffset = shadowOffset v.shadowOffset = shadowOffset
v.contentMode = contentMode v.contentMode = contentMode
v.layer.transform = layer.transform v.transform = transform
v.backgroundColor = backgroundColor
print(motionRotationAngle)
isHidden = true isHidden = true
(self as? Pulseable)?.pulse.pulseLayer?.isHidden = false (self as? Pulseable)?.pulse.pulseLayer?.isHidden = false
...@@ -372,21 +377,18 @@ extension MotionTransition { ...@@ -372,21 +377,18 @@ extension MotionTransition {
var snapshotAnimations = [CABasicAnimation]() var snapshotAnimations = [CABasicAnimation]()
var snapshotChildAnimations = [CABasicAnimation]() var snapshotChildAnimations = [CABasicAnimation]()
snapshotAnimations.append(Motion.position(to: tv.motionPosition))
let sizeAnimation = Motion.size(tv.bounds.size) let sizeAnimation = Motion.size(tv.bounds.size)
snapshotAnimations.append(sizeAnimation) let cornerRadiusAnimation = Motion.corner(radius: tv.cornerRadius)
snapshotChildAnimations.append(sizeAnimation)
snapshotChildAnimations.append(Motion.position(x: tv.bounds.width / 2, y: tv.bounds.height / 2))
snapshotAnimations.append(Motion.rotate(angle: tv.motionRotationAngle))
snapshotAnimations.append(sizeAnimation)
snapshotAnimations.append(cornerRadiusAnimation)
snapshotAnimations.append(Motion.position(to: tv.motionPosition))
snapshotAnimations.append(Motion.rotation(angle: tv.motionRotationAngle))
snapshotAnimations.append(Motion.background(color: tv.backgroundColor ?? .clear)) snapshotAnimations.append(Motion.background(color: tv.backgroundColor ?? .clear))
let cornerRadiusAnimation = Motion.corner(radius: tv.cornerRadius)
snapshotAnimations.append(cornerRadiusAnimation)
snapshotChildAnimations.append(cornerRadiusAnimation) snapshotChildAnimations.append(cornerRadiusAnimation)
snapshotChildAnimations.append(sizeAnimation)
snapshotChildAnimations.append(Motion.position(x: tv.bounds.width / 2, y: tv.bounds.height / 2))
let snapshot = fv.motionTransitionSnapshot(afterUpdates: true) let snapshot = fv.motionTransitionSnapshot(afterUpdates: true)
transitionView.insertSubview(snapshot, belowSubview: transitionSnapshot) transitionView.insertSubview(snapshot, belowSubview: transitionSnapshot)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment