get X Z Translate animation - Android Animation

Android examples for Animation:Translate Animation

Description

get X Z Translate animation

Demo Code


//package com.java2s;

import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;

public class Main {
    public static Animation getXZTranslate(float fromXZoom, float toXZoom,
            long duration) {
        TranslateAnimation animation = new TranslateAnimation(
                Animation.RELATIVE_TO_SELF, fromXZoom,
                Animation.RELATIVE_TO_SELF, toXZoom,
                Animation.RELATIVE_TO_SELF, 0.0f,
                Animation.RELATIVE_TO_SELF, 0.0f);
        animation.setFillAfter(true);/*from   w ww  .  j  av  a  2s  . c  o  m*/
        animation.setDuration(duration);
        return animation;
    }
}

Related Tutorials