Performing advanced animations
We mentioned that transitions are great for guidance and navigation, and part of that concept is providing clarity about incoming and leaving views from our canvas. Sliding a view from the bottom can provide a sense of a drawer being opened and closed, and scaling a view can visually represent the progress of an ongoing process.
So far, we have discussed how to animate views from one state to another. Now, we will explore transitions – a way to animate views when they appear or disappear.
Performing transitions
Implementing a view transition is easy – we have some nice built-in transitions to choose from, and if that’s not enough, we can also create a custom transition.
Let’s start with some basic, built-in transitions.
Implementing built-in transitions
To add a transition, we should use the transition
modifier with the specific view we want to animate, triggering it using the withAnimation
function we learned...