Objectanimator not only moves the position, but also moves the object view
First come to the code snippet:
Y-Axis transformation
Objectanimator OA = objectanimator.offloat (Imageviewlist.get (i), "Translationy", y0 + y, y0);
X-Axis transformation
Objectanimator ob = Objectanimator.offloat (Imageviewlist.get (i), "Translationx", x0+x, x0);
Animatorset set = new Animatorset ();
Set.playtogether (OA, OB);
Set.setinterpolator (New Bounceinterpolator ());
Set.setduration (500);
Set.start ();
Set rotation around the x-axis
Objectanimator of =
Objectanimator.offloat (Imageviewlist.get (i), "RotationX", 0.0F, 360.0F). Setduration (500);
Sets the animation order.
Sometimes, the beginning of some animations depends on the start or end of other animations, and you can use Animatorset to bind these animator.
- Animatorset bouncer = new Animatorset ();
- Bouncer.play (Bounceanim). before (SQUASHANIM1);
- Bouncer.play (SQUASHANIM1). with (SQUASHANIM2);
- Bouncer.play (SQUASHANIM1). with (STRETCHANIM1);
- Bouncer.play (SQUASHANIM1). with (STRETCHANIM2);
- Bouncer.play (Bouncebackanim). After (STRETCHANIM2);
- Valueanimator Fadeanim = Objectanimator.offloat (Newball, "Alpha", 1f, 0f);
- Fadeanim.setduration (250);
- Animatorset Animatorset = new Animatorset ();
- Animatorset.play (Bouncer). before (Fadeanim);
- Animatorset.start ();
Animation effect:
GitHub Address:
Https://github.com/cxmscb/ObjectAnimation01
Objectanimator of Android Animation