Animation 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 Animation setDuration method.

This code example shows how to use the following methods:setAnimationListener, setDuration, setFillBefore, setFillEnabled, setInterpolator
This code example shows how to use the following methods:setDuration, setFillAfter, setFillEnabled, setInterpolator
			if(olddegree == 0 && newdegree == 270){
				newdegree = -90;
			} else if(olddegree == 270 && newdegree == 0){
				newdegree = 360;
			} 
			retval = new RotateAnimation(olddegree,
					newdegree,
					Animation.RELATIVE_TO_SELF,
					0.5f, 
					Animation.RELATIVE_TO_SELF,
					0.5f); 
 
			retval.setDuration(500);
			retval.setFillEnabled(true);
			retval.setFillAfter(true);
			retval.setInterpolator(new DecelerateInterpolator());
		} 
 
		return retval;
	} 
	 
8
CodeRank
This code example shows how to use the following methods:setAnimationListener, setDuration, setInterpolator
      anim=new TranslateAnimation(0.0f, 0.0f,
                                  getHeight(),
                                  0.0f); 
    } 
    else { 
      anim=new TranslateAnimation(0.0f, 0.0f, 0.0f,
                                  getHeight());
      anim.setAnimationListener(collapseListener);
    } 
     
    anim.setDuration(speed);
    anim.setInterpolator(new AccelerateInterpolator(1.0f));
    startAnimation(anim);
  } 
   
  Animation.AnimationListener collapseListener=new Animation.AnimationListener() {
    public void onAnimationEnd(Animation animation) { 
      setVisibility(View.INVISIBLE); 
    } 
     
8
CodeRank
This code example shows how to use the following methods:setDuration, setFillAfter, setInterpolator, setStartOffset
This code example shows how to use the following methods:setAnimationListener, setDuration
	            break; 
	        case BOTTOM:
	            y=getHeight();
	            break; 
		}		 
		TranslateAnimation anim=new TranslateAnimation(0, x, 0,y);
		anim.setDuration(ANIM_DURATION);
		anim.setAnimationListener(new AnimationListener() {
			 
			//@Override 
			public void onAnimationStart(Animation animation) {
				// TODO Auto-generated method stub 
			} 
			 
			//@Override 
			public void onAnimationRepeat(Animation animation) {
				// TODO Auto-generated method stub 
			} 
			 
			//@Override 
7
CodeRank
This code example shows how to use the following methods:setDuration, setFillAfter
			return null; 
		} 
 
		int dx = getLeft() - old_x;
		int dy = getTop() - old_y;
		Animation a = new TranslateAnimation(-dx, 0, -dy, 0);
		a.setFillAfter(true);
		a.setDuration(durationMillis);
 
		old_x = getLeft();
		old_y = getTop();
 
		return a;
	} 
 
} 
7
CodeRank
This code example shows how to use the following methods:setAnimationListener, setDuration, setFillBefore, setFillEnabled, setInterpolator
This code example shows how to use the following methods:setDuration, setInterpolator
    	outtoLeft.setInterpolator(new AccelerateInterpolator());
    	return outtoLeft;
    } 
 
    public static Animation inFromLeftAnimation() {
    	Animation inFromLeft = new TranslateAnimation(
    			Animation.RELATIVE_TO_PARENT,  -1.0f, Animation.RELATIVE_TO_PARENT,  0.0f,
    			Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,   0.0f
    	); 
    	inFromLeft.setDuration(DURATION);
    	inFromLeft.setInterpolator(new AccelerateInterpolator());
    	return inFromLeft;
    } 
     
    public static Animation outToRightAnimation() {
    	Animation outtoRight = new TranslateAnimation(
    			Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,  +1.0f,
    			Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,   0.0f
    	); 
    	outtoRight.setDuration(DURATION);
7
CodeRank
This code example shows how to use the following methods:setAnimationListener, setDuration
    } 
 
    @Override 
    public void onSizeChanged(int w, int h, int oldW, int oldH) {
        mWidth = w;
        inLeft   = new TranslateAnimation(mWidth, 0, 0, 0);
        inLeft.setAnimationListener(this);
        outLeft  = new TranslateAnimation(0, -mWidth, 0, 0);
        inRight  = new TranslateAnimation(-mWidth, 0, 0, 0);
        inRight.setAnimationListener(this);
        outRight = new TranslateAnimation(0, mWidth, 0, 0);
 
        inLeft.setDuration(ANIM_DURATION);
        outLeft.setDuration(ANIM_DURATION);
        inRight.setDuration(ANIM_DURATION);
        outRight.setDuration(ANIM_DURATION);
    } 
 
    @Override 
    protected void onFinishInflate() { 
7
CodeRank
This code example shows how to use the following methods:setDuration, setFillAfter, setStartOffset
    float sign = left ? 1f : -1f;
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.setRepeatCount(Animation.INFINITE);
    animationSet.setRepeatMode(Animation.RESTART);
 
    TranslateAnimation move = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, sign * 0.70f,
        Animation.RELATIVE_TO_PARENT, sign * -0.70f, Animation.RELATIVE_TO_PARENT, 0,
        Animation.RELATIVE_TO_PARENT, 0);
    move.setStartOffset(0);
    move.setDuration(speed);
    move.setFillAfter(true);
    animationSet.addAnimation(move);
    view.startAnimation(animationSet);
  } 
 
  /** 
   * Animates a component (using pre-defined animation kinds). 
   * 
   * @param view  component to animate 
   * @param animation  animation kind 
7
CodeRank

Related Animation setDuration Questions & Answers:

setDuration Method Overview
How long this animation should last.
See Code Examples for other Android Animation Methods: