Code example for AnimatorSet

Methods: play, start

0
                    mSaverView.setY(nexty); 
                    ObjectAnimator.ofFloat(mSaverView, "alpha", 0f, 1f) 
                        .setDuration(FADE_TIME) 
                        .start(); 
                } else { 
                    AnimatorSet s = new AnimatorSet(); 
                    Animator xMove   = ObjectAnimator.ofFloat(mSaverView, 
                                         "x", mSaverView.getX(), nextx); 
                    Animator yMove   = ObjectAnimator.ofFloat(mSaverView, 
                                         "y", mSaverView.getY(), nexty); 
 
                    Animator xShrink = ObjectAnimator.ofFloat(mSaverView, "scaleX", 1f, 0.85f); 
                    Animator xGrow   = ObjectAnimator.ofFloat(mSaverView, "scaleX", 0.85f, 1f); 
 
                    Animator yShrink = ObjectAnimator.ofFloat(mSaverView, "scaleY", 1f, 0.85f); 
                    Animator yGrow   = ObjectAnimator.ofFloat(mSaverView, "scaleY", 0.85f, 1f); 
                    AnimatorSet shrink = new AnimatorSet(); shrink.play(xShrink).with(yShrink); 
                    AnimatorSet grow = new AnimatorSet(); grow.play(xGrow).with(yGrow); 
 
                    Animator fadeout = ObjectAnimator.ofFloat(mSaverView, "alpha", 1f, 0f); 
                    Animator fadein = ObjectAnimator.ofFloat(mSaverView, "alpha", 0f, 1f); 
 
 
                    if (SLIDE) { 
                        s.play(xMove).with(yMove); 
                        s.setDuration(SLIDE_TIME); 
 
                        s.play(shrink.setDuration(SLIDE_TIME/2)); 
                        s.play(grow.setDuration(SLIDE_TIME/2)).after(shrink); 
                        s.setInterpolator(mSlowStartWithBrakes); 
                    } else { 
                        AccelerateInterpolator accel = new AccelerateInterpolator(); 
                        DecelerateInterpolator decel = new DecelerateInterpolator(); 
 
                        shrink.setDuration(FADE_TIME).setInterpolator(accel); 
                        fadeout.setDuration(FADE_TIME).setInterpolator(accel); 
                        grow.setDuration(FADE_TIME).setInterpolator(decel); 
                        fadein.setDuration(FADE_TIME).setInterpolator(decel); 
                        s.play(shrink); 
                        s.play(fadeout); 
                        s.play(xMove.setDuration(0)).after(FADE_TIME); 
                        s.play(yMove.setDuration(0)).after(FADE_TIME); 
                        s.play(fadein).after(FADE_TIME); 
                        s.play(grow).after(FADE_TIME); 
                    } 
                    s.start(); 
                } 
 
                long now = System.currentTimeMillis(); 
                long adjust = (now % 60000); 
                delay = delay