Book Image

Mastering Android Game Development

By : Raul Portales
Book Image

Mastering Android Game Development

By: Raul Portales

Overview of this book

Table of Contents (18 chapters)
Mastering Android Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
API Levels for Android Versions
Index

Chapter 8. The Animation Framework

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...