Android Three animation principles

Source: Internet
Author: User

Android initially has two animations: frameAnimation(frame-by-frames animation) Tween Animation(motion Tween)

How the two animations work:

Frame Animation: The general meaning is to animate multiple images of a UI design, and then play them together in a coherent way, similar to how early movies work.

Tween Animation: is a series of animations of a View, including fading (Alpha), scaling (scale ), pan (Translate), rotation (Rotate) four modes

However, with the start of the Android3.0 version,theAndroid system gives us a new animation mode,the propertyAnimation (property animation),

Tween Animation Several major drawbacks of animation:


1:Tween Animation(tweened animation) is only forView, detached from theViewCan not be manipulated, this sentence means: if we need to aButton,ImageView,LinearLayoutor something else that inherits fromViewTo animate the various components of theTween Animationcan help us do the functions we need to do, but if we need to use a non-Viewanimation of the object, then there is no way to make the motion tween. For example, we have a customView, in thisViewhas a Pointobject is used to manage coordinates, and then theOnDraw ()The coordinates in the method are based on thepointdethe coordinate values are plotted. In other words, if we can Pointobject is animated, the entire customView, then the entire self-inheritanceViewthe current class is animated, but our goal is not to letViewThere are animations, just the animations in the Pointcoordinates to animate so that the tweened animation is not satisfied.


2 : Tween Animation animations have four animation operations (move, zoom, rotate, fade), but we now have a need to put the current View the background color to change it? Sorry Tween Animation can not help us to achieve.


3 : Tween Animation Animations just change View Show, but it doesn't really change . View properties, for example: we now have a small ball on the top of the screen, and then through the tweened animation let him move to the lower right corner, and then we have added a click event to the ball, I hope the position to move to the lower right corner of the ball can be clicked to enlarge the ball. But the Click event is absolutely not triggered, because the tweened animation just draws the ball to the bottom right corner of the screen, the actual ball still stops at the top of the screen, so you click in the lower right corner is not any reaction.


In response to these problems,Androidin the3.0The version was introduced after theProperty Animation(property animation), byProperty Animation(Property animation) We can see that property animations are no longer just forViewdesign, also proves not only limited in the movement, scaling, rotation and fade the operation of these kinds of animation, but also no longer just a visual animation effect, property animation is a constant operation of the value of the mechanism, and assign the value to the specified object of the specified property, can be any property of any object. So we can still have aViewTo move and scale, and also to customizeViewin the Pointthe object is animated. We just need to tell the system how long the animation is running, which type of animation to perform and the initial and ending values of the animation.


Android Three animation principles

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.