Objectanimator of Android Animation

Source: Internet
Author: User

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. 
  1. Animatorset bouncer = new Animatorset ();
  2. Bouncer.play (Bounceanim). before (SQUASHANIM1);
  3. Bouncer.play (SQUASHANIM1). with (SQUASHANIM2);
  4. Bouncer.play (SQUASHANIM1). with (STRETCHANIM1);
  5. Bouncer.play (SQUASHANIM1). with (STRETCHANIM2);
  6. Bouncer.play (Bouncebackanim). After (STRETCHANIM2);
  7. Valueanimator Fadeanim = Objectanimator.offloat (Newball, "Alpha", 1f, 0f);
  8. Fadeanim.setduration (250);
  9. Animatorset Animatorset = new Animatorset ();
  10. Animatorset.play (Bouncer). before (Fadeanim);
  11. Animatorset.start ();

Animation effect:

GitHub Address:

Https://github.com/cxmscb/ObjectAnimation01

Objectanimator of Android Animation

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.