Android Open Source Animation frame: Nineoldandroids

Source: Internet
Author: User

Introduced

The Android platform offers two animation systems: Property Animation (Android 3.0 introduction) and view Animation. Both of these animations are available, but property animation is preferred because it is more flexible and provides more powerful functionality. In addition to this, you can also use drawable Animation, which allows you to load a series of picture resources and play them in a frame in a specified order.
Property Animation
Introduced in Android 3.0 (API level One), the property animation system lets your animate properties of any object, Includi Ng ones that is not rendered to the screen. The system is extensible and lets your animate properties of custom types as well.
In Android 3.0 (API 11) was introduced, property animation lets you animate any object, including those objects that are not rendered to the screen. The property Animation is extensible and supports the object's custom attribute type animations.
View Animation
View Animation is the older system with can only being used for views. It is relatively easy to setup and offers enough capabilities to meet many application ' s needs.
View Animation is an old animation system and can only be used on a View object. It is relatively simple to use and provides enough animation to meet the needs of many applications.
drawable Animation
drawable animation involves displaying drawable resources One after another, like a roll of film. This method of animation was useful if you want to animate things that was easier to represent with drawable resources, suc h as a progression of bitmaps.

drawable animation One after another to show a series of picture resources, like a roll of film.

Android Property animation is available only on Android 3.0 (API 11), but fortunately already has the open source God to help us solve this problem. This project is nineoldandroids .

nineoldandroids Honeycomb animation API to the entire Android version platform, making valueanimator, objectanimator, etc. honeycomb Animation API can not change a line of code, only modify the import package name is fully compatible with the new API.

Usage

If you are familiar with the Honeycomb animation API, then it is very simple to use, just replace the import android.animation.ObjectAnimator with Com.nineoldandroids.animation.ObjectAnimator can be.

?
123456 valueanimator Coloranim = Obje Ctanimator.ofint ( this ,  "BackgroundColor" ,  /*red*/0xffff8080,/*blue*/ 0xff8080ff );  coloranim.setduration ( 3000 ";   coloranim.setevaluator ( argbevaluator ());   Coloranim.setrepeatcount (valueanimator.infinite);   coloranim.setrepeatmode (valueanimator.reverse);   coloranim.start ();

Nineoldandroids Library is almost completely compatible with the latest Android 3.0 property Animation API

?
123456789101112 AnimatorSet set = new AnimatorSet(); set.playTogether(     ObjectAnimator.ofFloat(myView, "rotationX"0360),     ObjectAnimator.ofFloat(myView, "rotationY"0180),     ObjectAnimator.ofFloat(myView, "rotation"0, -90),     ObjectAnimator.ofFloat(myView, "translationX"090),     ObjectAnimator.ofFloat(myView, "translationY"090),     ObjectAnimator.ofFloat(myView, "scaleX"11.5f),     ObjectAnimator.ofFloat(myView, "scaleY"10.5f),     ObjectAnimator.ofFloat(myView, "alpha"10.25f, 1); set.setDuration(5 1000).start();

 

Android Open Source Animation frame: Nineoldandroids

Related Article

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.