AnimatorSet setDuration - top ranked examples from Open Source projects

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

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
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
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: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
This code example shows how to use the following methods:play, setDuration, start
		ObjectAnimator translationLeft = ObjectAnimator.ofFloat(m_tv, "X", 0f);
		ObjectAnimator translationDown = ObjectAnimator.ofFloat(m_tv, "Y",
				height);
		ObjectAnimator translationUp = ObjectAnimator.ofFloat(m_tv, "Y", 0);
 
		AnimatorSet as = new AnimatorSet();
		as.play(translationRight).before(translationLeft);
		as.play(translationRight).with(translationDown);
		as.play(translationLeft).with(translationUp);
 
		// 和上边四句等效,另一种写法 
        /* 
		AnimatorSet as = new AnimatorSet(); 
		as.playTogether(translationRight, translationDown); 
		as.playSequentially(translationRight, translationLeft); 
		as.playTogether(translationLeft, translationUp); 
        */ 
		as.setDuration(1500);
		as.start();
	} 

6
CodeRank
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
This code example shows how to use the following methods:addListener, play, setDuration
        mModestyPanel.setLayoutParams(layout);
        addView(mModestyPanel);
        mFadePanel = ObjectAnimator.ofFloat(mModestyPanel, "alpha", 0f);
        mFadeView = ObjectAnimator.ofFloat(null, "alpha", 0f);
        mAnimatorListener = new BringToFrontOnEnd();
        mTransitionAnimation = new AnimatorSet();
        mTransitionAnimation.play(mFadeView).with(mFadePanel);
        mTransitionAnimation.setDuration(CROSSFADE_TIME);
        mTransitionAnimation.addListener(mAnimatorListener);
    } 
 
    /** 
     * Visible for testing 
     * @hide 
     */ 
    public Animator getTransitionAnimation() {
        return mTransitionAnimation;
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:play, setDuration, start
 
	public void testAnimationBuilder(View v) {
		m_tv.setAlpha(1f);
		ObjectAnimator fadeOut = ObjectAnimator.ofFloat(m_tv, "alpha", 0f);
		ObjectAnimator fadeIn = ObjectAnimator.ofFloat(m_tv, "alpha", 1f);
		AnimatorSet as = new AnimatorSet();
		as.play(fadeOut).before(fadeIn);
		as.setDuration(2000); // 2 secs
		as.start();
	} 
 
	public void testPropertiesHolder(View v) {
		m_tv.setAlpha(1f);
		float h = m_tv.getHeight();
		float w = m_tv.getWidth();
		float x = m_tv.getX();
		float y = m_tv.getY();
 
		m_tv.setX(w);
		m_tv.setY(h);
5
CodeRank
This code example shows how to use the following methods:addListener, play, setDuration, setInterpolator, start
5
CodeRank
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; 
                } 

5
CodeRank

Related AnimatorSet setDuration Questions & Answers:

setDuration Method Overview
Sets the length of each of the current child animations of this AnimatorSet.
See Code Examples for other Android AnimatorSet Methods: