Android animation-related knowledge (a): Basic knowledge about animation

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/gaolh89/article/details/80526976

Animation is a human-computer interaction has been an important part in earlier Android versions, due to the mechanism of animation and drawing mechanism is not perfect, so Android interaction meet unexpectedly suffering from the disease. Android 4.X from the beginning, especially 5 after .X, Android animation system more sophisticated. Android animation as an important knowledge that every developer needs to master.

A Animation Category:

Animation Animation Android into view (View Animation), animation property (Property Animation).

Animation Animation Framework defines transparency, rotation, scaling and other types of mobile animated, and control of the entire View, ViewGroup realized in principle when the function is drawChild each drawing view where View View of the acquired value of the Animation Transformation, and call canvas.concat method, completed the animation frame by matrix operations, if the animation is not completed then continue to call invalidate () method to start drawing the next time to drive animations to finish drawing the entire animation

Wherein there are views Animation: frame animation (Frame Animation), tween (Tweened animation) and animation property is introduced Android 3.0 (API 11)..

Two-view movies:
simple use view animation, rich effect, it provides AlphaAnimation, RotateAnimatio, TranslateAnimation, ScaleAnimation four kinds of animation, and provides a set of Animationset animation, using a mix of animation, before Android3.0, view an animation dominance, but with the introduction of property after Android3.0 animation framework of its scenery will once was. Compared property animation, animated view of a very large flaw is not available interactive, occurs when a component view animation, its position in response to events still remain in place before the animation , the animation can only do so view the ordinary display effect, to avoid the occurrence of interaction, but it is also very obvious advantages, namely more efficient and easy to use. View the animation is very simple to use, not only can be described by a process of animation XML file, also can use the code to control the entire animation process.

The following one by one using the method described by way of example animated views of:

(A) transparent animations
(b) rotation animation
(c) panning animation
(four) zoom animation
(five) movie collection
(six) Animation listening

Three property animation:

Due to the limitations of view animation - animation only change in the display, and can not respond to events Therefore, after Android3.0, Google proposed a property animation of this new animation framework that helps developers to implement more extensive animation.

In Animator frame, is the most used and AnimatorSet ObjectAnimator fit, using ObjectAnimator more refined control, only control properties of an object, using a combination of a plurality of ObjectAnimator AnimatorSet to form an animation. ObjectAnimator automatically driven and , can call setFrameDelay (longframeDelay) a gap time between the animation frames, the frame rate adjustment, reduce animation frequently during drawing surface, while reducing the consumption of CPU resources without affecting the animation effect. most importantly, the animation properties by call the property get, set method to control a View of real property, so powerful attribute animation framework, basically can achieve all animation.

(A) ObjectAnimator

Guess you like

Origin blog.csdn.net/gaolh89/article/details/80526976