Improve animations (IOS-234)

This commit is contained in:
Nathan Mattes 2024-04-05 18:35:51 +02:00
parent 33653911c3
commit 985eb68766
1 changed files with 8 additions and 5 deletions

View File

@ -486,11 +486,13 @@ extension HomeTimelineViewController {
private func showTimelinePill() {
guard let timelinePillHiddenTopAnchor, let timelinePillVisibleTopAnchor else { return }
timelinePill.alpha = 0
NSLayoutConstraint.deactivate([timelinePillHiddenTopAnchor])
NSLayoutConstraint.activate([timelinePillVisibleTopAnchor])
UIView.animate(withDuration: 0.4) {
self.view.layoutIfNeeded()
UIView.animate(withDuration: 0.5, delay: 0.0, usingSpringWithDamping: 0.75, initialSpringVelocity: 0.9) { [weak self] in
self?.timelinePill.alpha = 1
self?.view.layoutIfNeeded()
}
}
@ -499,9 +501,10 @@ extension HomeTimelineViewController {
NSLayoutConstraint.deactivate([timelinePillVisibleTopAnchor])
NSLayoutConstraint.activate([timelinePillHiddenTopAnchor])
UIView.animate(withDuration: 0.4, animations: {
self.view.layoutIfNeeded()
timelinePill.alpha = 1
UIView.animate(withDuration: 0.5, animations: { [weak self] in
self?.timelinePill.alpha = 0
self?.view.layoutIfNeeded()
})
}