mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-12 06:16:09 +10:00
better animation
This commit is contained in:
@@ -2817,8 +2817,10 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi
|
||||
vc.previewImageViewInitalFrame = frame
|
||||
vc.previewImage = image
|
||||
|
||||
transitionView?.alpha = 0
|
||||
vc.afterDismissAction = { [weak self] in
|
||||
self?.view.window?.makeKeyAndVisible()
|
||||
transitionView?.alpha = 1
|
||||
}
|
||||
|
||||
mediaPreviewWindow.rootViewController = vc
|
||||
|
||||
@@ -77,14 +77,26 @@ class MediaPreviewViewController: UIViewController {
|
||||
//let finalWidth = UIScreen.mainScreen().bounds.width
|
||||
//let finalHeight = UIScreen.mainScreen().bounds.height
|
||||
|
||||
view.backgroundColor = UIColor.clearColor()
|
||||
|
||||
mediasCollectionView.alpha = 0
|
||||
mediaControlView.alpha = 0
|
||||
|
||||
UIView.animateWithDuration(1.25, delay: 0.0, options: .CurveEaseInOut, animations: { [weak self] in
|
||||
|
||||
self?.view.backgroundColor = UIColor.blackColor()
|
||||
|
||||
self?.previewImageView.frame = CGRect(x: 0, y: (viewHeight - previewImageViewHeight) * 0.5, width: previewImageViewWidth, height: previewImageViewHeight)
|
||||
|
||||
}, completion: { [weak self] _ in
|
||||
self?.mediasCollectionView.alpha = 1
|
||||
|
||||
UIView.animateWithDuration(0.25, delay: 0.0, options: .CurveEaseInOut, animations: { [weak self] in
|
||||
|
||||
self?.mediaControlView.alpha = 1
|
||||
|
||||
}, completion: nil)
|
||||
|
||||
self?.previewImageView.alpha = 0
|
||||
})
|
||||
|
||||
@@ -99,10 +111,17 @@ class MediaPreviewViewController: UIViewController {
|
||||
func dismiss() {
|
||||
|
||||
previewImageView.alpha = 1
|
||||
|
||||
mediasCollectionView.alpha = 0
|
||||
|
||||
UIView.animateWithDuration(0.25, delay: 0.0, options: .CurveEaseInOut, animations: { [weak self] in
|
||||
self?.mediaControlView.alpha = 0
|
||||
}, completion: nil)
|
||||
|
||||
UIView.animateWithDuration(1.25, delay: 0.0, options: .CurveEaseInOut, animations: { [weak self] in
|
||||
|
||||
self?.view.backgroundColor = UIColor.clearColor()
|
||||
|
||||
self?.previewImageView.frame = self?.previewImageViewInitalFrame ?? CGRectZero
|
||||
|
||||
}, completion: { [weak self] _ in
|
||||
|
||||
Reference in New Issue
Block a user