foreword
- The use of animation is a common knowledge in
Android
development - However, there are many kinds of animations and complicated use . Whenever they need to use custom animations to achieve complex animation effects , many developers seem helpless.
- This article will provide a
Android
comprehensive introduction to animation, including the type, use, principle, etc. of animation, so that you can better grasp animation and achieve more complex animation effects
content
1. Types of animations
Android
Animation is divided into two categories: view animation & property animation, as follows:
Among them, view animation is divided into: tween animation & frame-by-frame animation
- under. I will introduce the use & principles of these two categories and three animations in detail
2. View Animation
- Action object: view (
View
) - Specific classification: tween animation & frame-by-frame animation
These two view animations are described in detail below.
##2.1 Tween Animation
-
Introduction
-
Classification According to different animation effects, the tween animation is divided into 4 kinds of animations, as shown in the figure below.
Different types of animation correspond to different subclasses
- For specific use, please see the article Android animation: teach you how to use tween animation
2.2 Frame by frame animation
-
Introduction
-
For specific use, please see the article Android frame-by-frame animation: The use of frame-by-frame animation is all here!
3. Property animation
3.1 Why use property animation
-
Property animation (
Property Animation
) is a new animation mode provided afterAndroid 3.0
( )API 11
-
So why provide property animation(
Property Animation
)? -
Please see the picture below for details
3.2 Specific introduction
-
Introduction
-
The specific use classes of attribute animation are mainly:
ValueAnimator
class &ObjectAnimator
class, the details are as follows
For more detailed usage, please read the article: Android Attribute Animation: This is a very detailed attribute animation summary & strategy
4. Animation Summary & Comparison
4.1 Summary
4.2 The difference between the two types of animation
The fundamental difference between the two types of animation is whether to change the properties of the animation itself :
- View animation: There is no property to change the animation because the view animation only transforms the image during the animation process, thus achieving the animation effect
Transform operations include: translation, scaling, rotation, and transparency
-
Property animation: Changed the animation properties. Because property animation dynamically changes the object properties during the animation process, the animation effect is achieved.
-
Pay special attention when using view animation: no matter where the animation result is, the position of the View remains the same & the response area is in place and will not move according to the result; while property animation will make the animation move by changing the properties
5. Interpolator & Estimator
5.1 Introduction
5.2 Specific use
See the article: Android Animation: Do You Really Use Interpolators and Estimators? (including detailed example teaching)
6. Usage Questions & Suggestions
- There are many issues to be aware of when using animations
- Below, I will comprehensively introduce the use problems & suggestions in the animation process
7. Summary
- This article has
Android
carried out a detailed analysis of animation, I believe that through this article you can already achieve complex animation effects - A series of articles about
Android
animation
- For the use of animation, please refer to the article:
Android property animation: This is a very detailed property animation summary & strategy
Android animation: teach you how to use tween animation
Android Frame-by-Frame Animation: The use of frame-by-frame animation is all here!
-
For the principle of customizing View, please refer to the article I wrote:
(1) Custom View Basics - The most understandable series of custom View principles
(2) Custom View Measure process - the most understandable series of custom View principles
(3) Custom View Layout process - the most understandable series of custom View principles
(4) Custom View Draw process - the most understandable series of custom View principles
-
For the application of custom View, please refer to the article I wrote:
Teach you how to write a complete custom View
The most comprehensive and detailed explanation of the Path class - custom View application series
The most comprehensive and detailed explanation of the Canvas class - custom View application series
- Next, I will continue to analyze the relevant knowledge of Android . If you are interested, you can continue to pay attention to Carson_Ho's Android development notes.