Reputation: 36654
how to move an android view up and down smoothly 8 times?
Here is my code
final TranslateAnimation breathUpTranslateAnimation =
new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0F, Animation.RELATIVE_TO_SELF, 0.0F,
Animation.RELATIVE_TO_PARENT, 0.0F, Animation.RELATIVE_TO_SELF, -0.05F);
breathUpTranslateAnimation.setDuration(TOOLTIP_ANIM_DURATION);
//breathUpTranslateAnimation.setInterpolator(new DecelerateInterpolator());
breathUpTranslateAnimation.setRepeatCount(8);
breathUpTranslateAnimation.setRepeatMode(Animation.RESTART);
breathUpTranslateAnimation.setInterpolator(new DecelerateInterpolator());
//breathUpTranslateAnimation.setFillAfter(true);
toolTipLayout.startAnimation(breathUpTranslateAnimation);
but in reality, the view is moving up smoothly
and return very fast or immediately back to starting point.
I want it to be back smoothly as well.
Upvotes: 1
Views: 542
Reputation: 3508
Replace this line
breathUpTranslateAnimation.setRepeatMode(Animation.REVERSE);
Upvotes: 1