some animations added after Android 3.0 the Objectanimator in animator :
tweened animations can be achieved by:
1.alpha Transparency
The first parameter is the View object, the second argument is the type of the animation change, and the fourth parameter, in turn, starts the transparency and ends the transparency. Objectanimator alpha = objectanimator.offloat (text, "Alpha", 0f, 1f); Alpha.setduration (2000);// Set the animation time Alpha.setinterpolator (new Decelerateinterpolator ());//Set the animation plug, slow down Alpha.setrepeatcount (-1);//Set the animation repetition times, Here-1 stands for Infinity Alpha.setrepeatmode (animation.reverse);//Set animation loop mode. Alpha.start ();//Start animation.
2.scale
Animatorset animatorset = new Animatorset ();//Combo animation Objectanimator ScaleX = objectanimator.offloat (text, "ScaleX", 1f, 0f) ; Objectanimator ScaleY = objectanimator.offloat (text, "ScaleY", 1f, 0f); Animatorset.setduration (2000); Animatorset.setinterpolator (New Decelerateinterpolator ()); Animatorset.play (ScaleX). with (ScaleY);// Two animations start Animatorset.start at the same time ();
3.translate
Objectanimator translationup = objectanimator.offloat (Button, "Y", Button.gety (), 0); Translationup.setinterpolator ( New Decelerateinterpolator ()); Translationup.setduration (); Translationup.start ();
4. Rotate
Animatorset set = new Animatorset (); Objectanimator anim = Objectanimator offloat (phone, "RotationX", 0f, 180f); Anim.setduration (+); Objectanimator anim2 = Objectanimator offloat (phone, "RotationX", 180f, 0f); Anim2.setduration (+); Objectanimator anim3 = Objectanimator offloat (phone, "RotationY", 0f, 180f); Anim3.setduration (+); Objectanimator anim4 = Objectanimator offloat (phone, "RotationY", 180f, 0f); Anim4.setduration (+); Set.play (Anim). before (ANIM2); Executes the Anim animation first after performing the anim2 set.play (ANIM3). before (ANIM4); Set.start ();
tweened animations are not possible:
5.android Change the background color animation is implemented as follows
Objectanimator translationup = objectanimator.ofint (Button, "BackgroundColor", Color.Red, Color.Blue, Color.GRAY, Color.green); Translationup.setinterpolator (new Decelerateinterpolator ()); translationup.setduration (1500); Translationup.setrepeatcount ( -1); Translationup.setrepeatmode (animation.reverse);/* * Argbevaluator: This evaluator can be used to perform interpolation between types of integer values that represent ARGB colors. * Floatevaluator: This evaluator can be used to perform interpolation between floating-point values. * Intevaluator: This evaluator can be used to perform interpolation between type int values. * Rectevaluator: This evaluator can be used to perform interpolation between types of rectangular values. * * Because this example is changing the background color of the view's BackgroundColor property, the Argbevaluator */translationup.setevaluator (New Argbevaluator ()) is used here; Translationup.start ();
More detailed tutorials on animation:
Android Properties Animation Property Animation series One of the Valueanimator:
http://blog.csdn.net/feiduclear_up/article/details/45893619
Android Properties Animation Property Animation series two of the Objectanimator
http://blog.csdn.net/feiduclear_up/article/details/45915377
The Objectanimator of Android animation