Add animation when transitioning between the large and small view

This commit is contained in:
Stephen Byatt 2021-06-26 20:50:04 +10:00
parent fa3f36f1fc
commit d72991ca7d
2 changed files with 10 additions and 7 deletions

View File

@ -687,13 +687,18 @@ class PlayerViewController: UIViewController, GCKDiscoveryManagerListener, GCKRe
} }
func smallNextUpView() { func smallNextUpView() {
upNextViewModel.largeView = false UIView.animate(withDuration: 0.2, delay: 0, options: .curveEaseIn) { [self] in
upNextView.frame = smallView upNextViewModel.largeView = false
upNextView.frame = smallView
}
} }
func largeNextUpView() { func largeNextUpView() {
upNextViewModel.largeView = true UIView.animate(withDuration: 0.1, delay: 0, options: .curveEaseOut) { [self] in
upNextView.frame = largeView upNextViewModel.largeView = true
upNextView.frame = largeView
}
} }
func setupNextUpView() { func setupNextUpView() {
@ -973,9 +978,9 @@ extension PlayerViewController: VLCMediaPlayerDelegate {
timeText.text = String(mediaPlayer.remainingTime.stringValue.dropFirst()) timeText.text = String(mediaPlayer.remainingTime.stringValue.dropFirst())
if CACurrentMediaTime() - controlsAppearTime > 5 { if CACurrentMediaTime() - controlsAppearTime > 5 {
self.smallNextUpView()
UIView.animate(withDuration: 0.5, delay: 0, options: .curveEaseOut, animations: { UIView.animate(withDuration: 0.5, delay: 0, options: .curveEaseOut, animations: {
self.videoControlsView.alpha = 0.0 self.videoControlsView.alpha = 0.0
self.smallNextUpView()
}, completion: { (_: Bool) in }, completion: { (_: Bool) in
self.videoControlsView.isHidden = true self.videoControlsView.isHidden = true
self.videoControlsView.alpha = 1 self.videoControlsView.alpha = 1

View File

@ -76,8 +76,6 @@ struct VideoUpNextView: View {
.cornerRadius(5) .cornerRadius(5)
.shadow(radius: 10) .shadow(radius: 10)
) )
} }
else { else {
return AnyView(EmptyView()) return AnyView(EmptyView())