Android Animation - 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 Animation class.

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: setInterpolator, addAnimation, setDuration
    fadeOut=AnimationUtils.loadAnimation(ctxt, R.anim.fade);
  } 
   
  public void toggle() { 
    TranslateAnimation anim=null;
    AnimationSet set=new AnimationSet(true);
     
    isOpen=!isOpen;
     
    if (isOpen) {
      setVisibility(View.VISIBLE);
      anim=new TranslateAnimation(0.0f, 0.0f,
                                  getHeight(),
                                  0.0f); 
    } 
    else { 
      anim=new TranslateAnimation(0.0f, 0.0f, 0.0f,
                                  getHeight());
      anim.setAnimationListener(collapseListener);
      set.addAnimation(fadeOut);

9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
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;
	} 
	 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
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); 
    } 
     
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setAnimationListener, setDuration, setFillAfter, setInterpolator, setStartOffset
    } 
 
    private static Animation createExpandAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
            long startOffset, long duration, Interpolator interpolator) {
        Animation animation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 0, 720);
        animation.setStartOffset(startOffset);
        animation.setDuration(duration);
        animation.setInterpolator(interpolator);
        animation.setFillAfter(true);
 
        return animation;
    } 
 
    private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
            long startOffset, long duration, Interpolator interpolator) {
        AnimationSet animationSet = new AnimationSet(false);
        animationSet.setFillAfter(true);
 
        final long preDuration = duration / 2;
        Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android Animation Questions & Answers:

Other Android Animation Examples

9:	// animation listeners
10:		@Override
11:		public void onAnimationEnd(Animation animation) {
12:			// Take any action after completing the animation
13:			// check for fade in animation
-
20:	
21:		@Override
22:		public void onAnimationRepeat(Animation animation) {
23:			// Animation is repeating
24:		}
-
25:	
26:		@Override
27:		public void onAnimationStart(Animation animation) {
28:			// Animation started
29:		}

Read More

1:	Animation animFadeIn, animFadeOut;
2:	.
3:	.

Read More

16:	
17:		// Animation
18:		Animation animFadein;
19:	
20:		@Override
-
49:	
50:		@Override
51:		public void onAnimationEnd(Animation animation) {
52:			// Take any action after completing the animation
53:	
-
61:	
62:		@Override
63:		public void onAnimationRepeat(Animation animation) {
64:			// TODO Auto-generated method stub
65:	
-
67:	
68:		@Override
69:		public void onAnimationStart(Animation animation) {
70:			// TODO Auto-generated method stub
71:

Read More

See Code Examples for Android Animation Methods: