out To Right Animation - Android Animation

Android examples for Animation:Move Animation

Description

out To Right Animation

Demo Code


//package com.java2s;

import android.view.animation.AccelerateInterpolator;

import android.view.animation.Animation;

import android.view.animation.TranslateAnimation;

public class Main {
    static public Animation outToRightAnimation() {

        Animation outtoRight = new TranslateAnimation(

        Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
                +1.0f,/* w w w. j  av a2s.  c  om*/

                Animation.RELATIVE_TO_PARENT, 0.0f,
                Animation.RELATIVE_TO_PARENT, 0.0f

        );

        outtoRight.setDuration(200);

        outtoRight.setInterpolator(new AccelerateInterpolator());

        return outtoRight;

    }

    static public Animation outToRightAnimation(int duration) {

        Animation outtoRight = new TranslateAnimation(

        Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
                +1.0f,

                Animation.RELATIVE_TO_PARENT, 0.0f,
                Animation.RELATIVE_TO_PARENT, 0.0f

        );

        outtoRight.setDuration(duration);

        outtoRight.setInterpolator(new AccelerateInterpolator());

        return outtoRight;

    }
}

Related Tutorials