Android provides a variety of powerful APIs to apply animation to UI elements. This chapter aims at providing an overview of the options available to help you decide which approach is best for your needs.
Before we start adding animations, we will refactor our code a bit to make the usage of animations easier by creating a callback on our base fragment once the layout has been completed.
Then, we will see how to define a traditional frame-by-frame animations that can be used in an ImageView
. We will also see how to incorporate them in our GameEngine
in the form of AnimatedSprite
.
The core of the chapter is about the different ways to animate views. We will start talking about interpolators and their role in the Android Animation Framework. Then, we will learn about the old method called view animation and we will use it to animate some areas of the game, including how to show and hide our custom dialogs.
Then, we will talk about ValueAnimator
, PropertyAnimator...