-
Notifications
You must be signed in to change notification settings - Fork 62
Animating
Evgenii Neumerzhitckii edited this page Jun 21, 2016
·
10 revisions
Drawing of White Dodo by Frederick William Frohawk, 1907. Source: Wikipedia.
One can customize both hide and show animation for the notification bar before it is shown. You can either use one of the animation presets or provide your own animation closure.
There are animation presets defined in DodoAnimations
enum.
// Use existing animations
view.dodo.style.bar.animationShow = DodoAnimations.rotate.show
view.dodo.style.bar.animationHide = DodoAnimations.slideRight.hide
// Turn off animation
view.dodo.style.bar.animationShow = DodoAnimations.noAnimation.show
view.dodo.style.bar.animationHide = DodoAnimations.noAnimation.hide
// Customize duration of the animation
view.dodo.style.bar.animationShowDuration = 0.5
view.dodo.style.bar.animationHideDuration = 1
You can use your own code for animating the bar view. If you do so make sure you call the onCompleted
parameter.
view.dodo.style.bar.animationShow = { view, duration, locationTop, onCompleted in
let actualDuration = duration ?? 0.5
view.alpha = 0
UIView.animate(withDuration: actualDuration,
animations: {
view.alpha = 1
},
completion: { finished in
onCompleted()
}
)
}