Android AnimatorSet - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android AnimatorSet class.

This code example shows how to use the following methods: play, playSequentially, start
        skewAnim.setDuration(100);
        // and wobble it 
        ObjectAnimator wobbleAnim = ObjectAnimator.ofFloat(this, "skewX", 0);
        wobbleAnim.setInterpolator(sOvershooter);
        wobbleAnim.setDuration(150);
        AnimatorSet set = new AnimatorSet();
        set.playSequentially(moveAnim, skewAnim, wobbleAnim);
        if (finishDownAnim != null) {
            set.play(finishDownAnim).before(moveAnim);
        } 
        set.start();
        mOnLeft = !mOnLeft;
    } 
 
    /** 
     * Restore the button to its un-pressed state 
     */ 
    private void runCancelAnim() { 
        if (downAnim != null && downAnim.isRunning()) {
            downAnim.cancel();
Full Snippet Info
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: playSequentially, start
This code example shows how to use the following methods: addListener, playTogether, setDuration, start
        // Post this on the UI thread's message queue. It's needed for the items to be already measured 
        new Handler().post(new Runnable() {
 
            @Override 
            public void run() { 
                mSetAnim = new AnimatorSet();
                mTopImage.setLayerType(View.LAYER_TYPE_HARDWARE, null);
                mBottomImage.setLayerType(View.LAYER_TYPE_HARDWARE, null);
                mSetAnim.addListener(new Animator.AnimatorListener() {
                    @Override 
                    public void onAnimationStart(Animator animation) {
                    } 
 
                    @Override 
                    public void onAnimationEnd(Animator animation) {
                        clean(destActivity);
                    } 
 
                    @Override 
                    public void onAnimationCancel(Animator animation) {

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: play, playSequentially, start
        skewAnim.setDuration(100);
        // and wobble it 
        ObjectAnimator wobbleAnim = ObjectAnimator.ofFloat(this, "skewX", 0);
        wobbleAnim.setInterpolator(sOvershooter);
        wobbleAnim.setDuration(150);
        AnimatorSet set = new AnimatorSet();
        set.playSequentially(moveAnim, skewAnim, wobbleAnim);
        if (finishDownAnim != null) {
            set.play(finishDownAnim).before(moveAnim);
        } 
        set.start();
        mOnLeft = !mOnLeft;
    } 
 
    /** 
     * Restore the button to its un-pressed state 
     */ 
    private void runCancelAnim() { 
        if (downAnim != null && downAnim.isRunning()) {
            downAnim.cancel();
Full Snippet Info
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: playTogether, setDuration, start
        if (mGlowBG != null) {
            if (pressed != isPressed()) {
                if (mPressedAnim != null && mPressedAnim.isRunning()) {
                    mPressedAnim.cancel();
                } 
                final AnimatorSet as = mPressedAnim = new AnimatorSet();
                if (pressed) {
                    if (mGlowScale < GLOW_MAX_SCALE_FACTOR) 
                        mGlowScale = GLOW_MAX_SCALE_FACTOR;
                    if (mGlowAlpha < BUTTON_QUIESCENT_ALPHA)
                        mGlowAlpha = BUTTON_QUIESCENT_ALPHA;
                    setDrawingAlpha(1f); 
                    as.playTogether(
                        ObjectAnimator.ofFloat(this, "glowAlpha", 1f),
                        ObjectAnimator.ofFloat(this, "glowScale", GLOW_MAX_SCALE_FACTOR)
                    ); 
                    as.setDuration(50);
                } else { 
                    as.playTogether(
                        ObjectAnimator.ofFloat(this, "glowAlpha", 0f),

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: addListener, playTogether, setDuration, setInterpolator, start
This code example shows how to use the following methods: play
                xAnim.setRepeatMode(ValueAnimator.REVERSE);
                xAnim.setInterpolator(new AccelerateInterpolator(2f));
 
                ObjectAnimator alphaAnim = ObjectAnimator.ofFloat(ball, "alpha", 1f, .5f).
                        setDuration(1000); 
                AnimatorSet alphaSeq = new AnimatorSet();
                alphaSeq.play(alphaAnim);
 
                animation = new AnimatorSet();
                ((AnimatorSet) animation).playTogether(yAnim, xAnim);
                animation.addListener(this);
            } 
        } 
 
        public void startAnimation(boolean endImmediately) {
            this.endImmediately = endImmediately;
            startText.setAlpha(.5f);
            repeatText.setAlpha(.5f);
            cancelText.setAlpha(.5f);
            endText.setAlpha(.5f);
Full Snippet Info
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: addListener, play, start
        } else { 
            final long duration = getResources().getInteger(android.R.integer.config_shortAnimTime);
 
            // Animate if we have Honeycomb APIs, don't animate otherwise 
            mIsAnimating = true;
            AnimatorSet animatorSet = new AnimatorSet();
            mMasterView.setLayerType(LAYER_TYPE_HARDWARE, null);
            mDetailView.setLayerType(LAYER_TYPE_HARDWARE, null);
            animatorSet
                    .play(ObjectAnimator
                            .ofFloat(mMasterView, "translationX", translationX)
                            .setDuration(duration))
                    .with(ObjectAnimator
                            .ofFloat(mDetailView, "translationX", translationX)
                            .setDuration(duration));
            animatorSet.addListener(this);
            animatorSet.start();
 
            // For API level 12+, use this instead: 
            // mMasterView.animate().translationX().setDuration(duration); 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: playTogether, setDuration, setInterpolator, start
                                    } catch (SecurityException e) {
                                    } 
                                } 
                            }, LAUNCH_ZOOM_TIME);
                            endscale = 0;
                            AnimatorSet s = new AnimatorSet();
                            s.playTogether(
                                ObjectAnimator.ofFloat(this, "scaleX", 15f),
                                ObjectAnimator.ofFloat(this, "scaleY", 15f),
                                ObjectAnimator.ofFloat(this, "alpha", 0f)
                            ); 
 
                            // make sure things are still moving until the very last instant the 
                            // activity is visible 
                            s.setDuration((int)(LAUNCH_ZOOM_TIME * 1.25));
                            s.setInterpolator(new android.view.animation.AccelerateInterpolator(3));
                            s.start();
                        } 
                        break; 
                } 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: addListener, play, start
        } else { 
            final long duration = getResources().getInteger(android.R.integer.config_shortAnimTime);
 
            // Animate if we have Honeycomb APIs, don't animate otherwise 
            mIsAnimating = true;
            AnimatorSet animatorSet = new AnimatorSet();
            mMasterView.setLayerType(LAYER_TYPE_HARDWARE, null);
            mDetailView.setLayerType(LAYER_TYPE_HARDWARE, null);
            animatorSet
                    .play(ObjectAnimator
                            .ofFloat(mMasterView, "translationX", translationX)
                            .setDuration(duration))
                    .with(ObjectAnimator
                            .ofFloat(mDetailView, "translationX", translationX)
                            .setDuration(duration));
            animatorSet.addListener(this);
            animatorSet.start();
 
            // For API level 12+, use this instead: 
            // mMasterView.animate().translationX().setDuration(duration); 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android AnimatorSet Questions & Answers:

Other Android AnimatorSet Examples

18:	  private int width;
19:	  private int height;
20:	  private AnimatorSet set;
21:	
22:	  @Override
-
54:	  }
55:	
56:	  private AnimatorSet createAnimation() {
57:	    int nextX = randon.nextInt(width);
58:	    int nextY = randon.nextInt(height);
-
62:	    animation2 = ObjectAnimator.ofFloat(button, "y", nextY);
63:	    animation2.setDuration(1400);
64:	    AnimatorSet set = new AnimatorSet();
65:	    set.playTogether(animation1, animation2);
66:	    return set;
-
62:	    animation2 = ObjectAnimator.ofFloat(button, "y", nextY);
63:	    animation2.setDuration(1400);
64:	    AnimatorSet set = new AnimatorSet();
65:	    set.playTogether(animation1, animation2);
66:	    return set;

Read More

See Code Examples for Android AnimatorSet Methods: