get Translate Animation from Parameter passed in - Android Animation

Android examples for Animation:Translate Animation

Description

get Translate Animation from Parameter passed in

Demo Code


//package com.java2s;

import android.view.animation.Interpolator;

import android.view.animation.TranslateAnimation;

public class Main {

    public static TranslateAnimation getTranslateAnimation(
            float fromXDelta, float toXDelta, float fromYDelta,
            float toYDelta, long durationMillis, long startOffset,
            Interpolator i)// www.ja v  a2  s. c om

    {
        TranslateAnimation mTranAnima = new TranslateAnimation(fromXDelta,
                toXDelta, fromYDelta, toYDelta);
        mTranAnima.setDuration(durationMillis);
        mTranAnima.setStartOffset(startOffset);
        mTranAnima.setFillAfter(true);
        mTranAnima.setInterpolator(i);
        return mTranAnima;
    }
}

Related Tutorials