Best code examples for Android Animation class (android.view.animation.Animation)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Animation class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android Animation examples from Open Source projects
This code example shows how to use the following methods: setAnimationListener, setDuration, setFillBefore, setFillEnabled, setInterpolator
145:	if (mExpanded) { 
-
149:	anim = new TranslateAnimation(0, -offset, 0, 0); 
150:	mFillOffset = -offset; 
151:	} 
152:	mExpanded = !mExpanded; 
153:	anim.setFillEnabled(true); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: setInterpolator, addAnimation, setDuration
49:	AnimationSet set=new AnimationSet(true); 
-
63:	set.addAnimation(fadeOut); 
-
66:	set.addAnimation(anim); 
67:	set.setDuration(speed); 
68:	set.setInterpolator(new AccelerateInterpolator(1.0f)); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: setDuration, setFillAfter, setFillEnabled, setInterpolator
106:	retval = new RotateAnimation(olddegree, 
-
113:	retval.setDuration(500); 
114:	retval.setFillEnabled(true); 
115:	retval.setFillAfter(true); 
116:	retval.setInterpolator(new DecelerateInterpolator()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setAnimationListener, setDuration, setInterpolator
55:	anim=new TranslateAnimation(0.0f, 0.0f, 0.0f, 
-
57:	anim.setAnimationListener(collapseListener); 
-
60:	anim.setDuration(speed); 
61:	anim.setInterpolator(new AccelerateInterpolator(1.0f)); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setAnimationListener, setDuration, setFillAfter, setInterpolator, setStartOffset
168:	animation.setStartOffset(startOffset); 
169:	animation.setDuration(duration); 
170:	animation.setInterpolator(interpolator); 
171:	animation.setFillAfter(true); 
-
222:	animation.setAnimationListener(new AnimationListener() { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setFillEnabled, addAnimation, setFillAfter
378:	AnimationSet animSet = new AnimationSet(true); 
-
385:	animSet.addAnimation(scale); 
386:	animSet.addAnimation(alpha); 
387:	animSet.setFillEnabled(true); 
388:	animSet.setFillAfter(true); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setDuration, setRepeatCount, setRepeatMode
45:	ScaleAnimation a = new ScaleAnimation(1.0f, 2.0f, 1.0f, 2.0f, 
-
48:	a.setDuration(2000); 
49:	a.setRepeatCount(Animation.INFINITE); 
50:	a.setRepeatMode(Animation.REVERSE); 
51:	view.startAnimation(a); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: setAnimationListener, setDuration
134:	TranslateAnimation anim=new TranslateAnimation(0, x, 0,y); 
135:	anim.setDuration(ANIM_DURATION); 
136:	anim.setAnimationListener(new AnimationListener() { 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDuration, setFillAfter
117:	Animation a = new TranslateAnimation(-dx, 0, -dy, 0); 
118:	a.setFillAfter(true); 
119:	a.setDuration(durationMillis); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setAnimationListener, setDuration, setFillBefore, setFillEnabled, setInterpolator
145:	anim = new TranslateAnimation(0, -offset, 0, 0); 
-
149:	anim.setFillEnabled(true); 
150:	anim.setFillBefore(true); 
151:	anim.setDuration(300); 
152:	anim.setInterpolator(new AccelerateDecelerateInterpolator()); 
153:	anim.setAnimationListener(new AnimationFiller()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDuration, setInterpolator
51:	Animation inFromLeft = new TranslateAnimation( 
-
55:	inFromLeft.setDuration(DURATION); 
56:	inFromLeft.setInterpolator(new AccelerateInterpolator()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setAnimationListener, setDuration
102:	inLeft   = new TranslateAnimation(mWidth, 0, 0, 0); 
103:	inLeft.setAnimationListener(this); 
-
109:	inLeft.setDuration(ANIM_DURATION); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDuration, setInterpolator
80:	AlphaAnimation fadeImage = new AlphaAnimation(0, 1); 
81:	fadeImage.setDuration(durationMillis); 
82:	fadeImage.setInterpolator(new DecelerateInterpolator()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setFillEnabled, addAnimation, setFillAfter
302:	AnimationSet animSet = new AnimationSet(true); 
-
308:	animSet.addAnimation(scale); 
309:	animSet.addAnimation(alpha); 
310:	animSet.setFillEnabled(true); 
311:	animSet.setFillAfter(true); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setRepeatCount, addAnimation, setRepeatMode
33:	AnimationSet animationSet = new AnimationSet(true); 
34:	animationSet.setRepeatCount(Animation.INFINITE); 
35:	animationSet.setRepeatMode(Animation.RESTART); 
-
43:	animationSet.addAnimation(move); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setAnimationListener, setDuration, setInterpolator
453:	animation = new TranslateAnimation(fromXDelta, toXDelta, fromYDelta, toYDelta); 
454:	animation.setDuration(calculatedDuration); 
455:	animation.setAnimationListener(animationListener); 
-
457:	animation.setInterpolator(new LinearInterpolator()); 
-
460:	animation.setInterpolator(mInterpolator); 
-
462:	startAnimation(animation); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: cancel, hasEnded
116:	if (old != null && !old.hasEnded()) { 
117:	old.cancel(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDuration, setInterpolator
123:	fadeIn.setInterpolator(new DecelerateInterpolator()); 
124:	fadeIn.setDuration(200); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDuration, setInterpolator, setRepeatCount
45:	RotateAnimation ra = new RotateAnimation(0, 360, centerX, centerY); 
46:	ra.setDuration(1000); 
47:	ra.setRepeatCount(-1); 
48:	ra.setInterpolator(new LinearInterpolator()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDuration, setRepeatCount, setRepeatMode
45:	ScaleAnimation a = new ScaleAnimation(1.0f, 2.0f, 1.0f, 2.0f, 
-
48:	a.setDuration(2000); 
49:	a.setRepeatCount(Animation.INFINITE); 
50:	a.setRepeatMode(Animation.REVERSE); 
51:	view.startAnimation(a); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setDuration, setInterpolator
18:	Animation inFromRight = new TranslateAnimation( 
-
22:	inFromRight.setDuration(DURATION); 
23:	inFromRight.setInterpolator(new AccelerateDecelerateInterpolator()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDuration, setInterpolator, setRepeatCount, setRepeatMode, setStartTime
849:	mAnimation = new AlphaAnimation(0.0f, 1.0f); 
850:	mAnimation.setRepeatMode(mBehavior); 
851:	mAnimation.setRepeatCount(Animation.INFINITE); 
852:	mAnimation.setDuration(mDuration); 
853:	mAnimation.setInterpolator(mInterpolator); 
854:	mAnimation.setStartTime(Animation.START_ON_FIRST_FRAME); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setAnimationListener, setDuration
673:	anim.setDuration(1000); // plenty of time for transitions 
-
680:	anim.setAnimationListener(mAnimationDoneListener); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setDuration, setFillAfter
206:	RotateAnimation rotate = new RotateAnimation(fromDegrees, toDegrees, 
-
209:	rotate.setDuration(durationMillis); 
210:	rotate.setFillAfter(true); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAnimationListener, setRepeatCount
69:	mAnimation.setAnimationListener(new Animation.AnimationListener() { 
-
84:	mAnimation.setRepeatCount(0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDuration, setInterpolator
127:	fadeOut.setInterpolator(new AccelerateInterpolator()); 
128:	fadeOut.setDuration(200); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDuration
43:	animation = new TranslateAnimation( 
-
47:	animation.setDuration(100); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDuration, setInterpolator
124:	Animation animation = new TranslateAnimation(0, 200, 0, 200); 
125:	animation.setDuration(1000); 
126:	animation.setInterpolator(this, interpolator); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDuration, setFillAfter
117:	Animation a = new TranslateAnimation(-dx, 0, -dy, 0); 
118:	a.setFillAfter(true); 
119:	a.setDuration(durationMillis); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setDuration, setFillAfter, setFillEnabled, setRepeatCount
401:	Animation animation = new RotateAnimation(previous, current, 
-
403:	animation.setDuration(250); 
404:	animation.setRepeatCount(0); 
405:	animation.setFillAfter(true); 
406:	animation.setFillEnabled(true); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDuration, setInterpolator
144:	new TranslateAnimation(Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, 
-
146:	animation.setDuration(ANIMATION_SPEED); 
147:	animation.setInterpolator(new AccelerateInterpolator()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAnimationListener, setDuration
13:	final TranslateAnimation toLeft = new TranslateAnimation(length, -length, 0, 0); 
-
16:	toLeft.setDuration(duration * 2); 
-
18:	toRight.setAnimationListener(new AnimationListener() { 
-
33:	toLeft.setAnimationListener(new AnimationListener() { 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDuration, setFillAfter, setInterpolator, setStartOffset
12:	Animation anim = new TranslateAnimation((float)w, 0, 0, 0); 
13:	anim.setDuration(t); 
14:	anim.setInterpolator( new DecelerateInterpolator((float)f) ); 
15:	anim.setFillAfter(true); 
16:	anim.setStartOffset(offset); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setAnimation, setAnimationListener, startNow, addAnimation, setDuration
65:	AnimationSet anim = new AnimationSet(true); 
66:	anim.addAnimation(new AlphaAnimation(1f, 0f)); 
-
68:	anim.addAnimation(new TranslateAnimation(0f, 100f, 0f, 0f)); 
-
70:	anim.addAnimation(new TranslateAnimation(0f, -100f, 0f, 0f)); 
-
73:	mMenus[menu].setAnimation(anim); 
74:	anim.setDuration(500); 
75:	anim.setAnimationListener(new Animation.AnimationListener() { 
-
89:	anim.startNow(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setAnimationListener, setDuration, setFillAfter, setStartOffset
31:	animation=new RotateAnimation(0, 180, Animation.RELATIVE_TO_SELF,0.5f, Animation.RELATIVE_TO_SELF, 1.0f); 
32:	animation.setDuration(duration); 
33:	animation.setFillAfter(true); 
34:	animation.setStartOffset(startOffset); 
-
36:	animation.setAnimationListener(new AnimationListener() { 
Full Snippet Info
6
CodeRank
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: