diff --git a/Packages/GalleryVC/Sources/GalleryVC/GalleryDismissAnimationController.swift b/Packages/GalleryVC/Sources/GalleryVC/GalleryDismissAnimationController.swift index 11fb98663..ab985eb29 100644 --- a/Packages/GalleryVC/Sources/GalleryVC/GalleryDismissAnimationController.swift +++ b/Packages/GalleryVC/Sources/GalleryVC/GalleryDismissAnimationController.swift @@ -47,8 +47,6 @@ class GalleryDismissAnimationController: NSObject, UIViewControllerAnimatedTrans container.addSubview(to.view) } - // This trick does not work as well here as it does for presentation, seemingly - // because the delayFactor:0.9 still results in the snapshot fading out too quickly :/ let sourceSnapshot = sourceView.snapshotView(afterScreenUpdates: false) if let sourceSnapshot { let snapshotContainer = sourceView.ancestorForInsertingSnapshot @@ -160,16 +158,21 @@ class GalleryDismissAnimationController: NSObject, UIViewControllerAnimatedTrans contentContainer.frame = sourceFrameInContainer content.view.frame = sourceSizeWithDestAspectRatioCenteredInContentContainer - content.view.layer.opacity = 0 itemViewController.setControlsVisible(false, animated: false, dueToUserInteraction: false) } + // Delay fading out the content because if it's still big while it's semi-transparent, + // seeing the stuff behind it looks odd. + animator.addAnimations({ + content.view.layer.opacity = 0 + }, delayFactor: 0.35) + if let sourceSnapshot { animator.addAnimations({ self.sourceView.layer.opacity = 1 sourceSnapshot.layer.opacity = 0 - }, delayFactor: 0.9) + }, delayFactor: 0.5) } animator.addCompletion { _ in