Create slow Move Animation - Android Animation

Android examples for Animation:Move Animation

Description

Create slow Move Animation

Demo Code


import android.graphics.Point;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.OvershootInterpolator;
import android.view.animation.TranslateAnimation;

public class Main {
  public static void slowMove(final View view, Point start, final Point end, int offset, int duration) {
    Animation animation = new TranslateAnimation(start.x - end.x, 0, start.y - end.y, 0);
    animation.setDuration(duration);//from  w ww .  j  a v  a2 s  .c  o m
    animation.setFillAfter(true);
    animation.setStartOffset(offset);
    animation.setInterpolator(new OvershootInterpolator(2F));
    view.startAnimation(animation);
    // moveViewCenterTo(view, end.x, end.y);
  }
}

Related Tutorials