main Fragment Back From Right Animation - Android Animation

Android examples for Animation:Move Animation

Description

main Fragment Back From Right Animation

Demo Code


//package com.java2s;

import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.BounceInterpolator;

import android.view.animation.TranslateAnimation;

public class Main {
    static public Animation mainFragmentBackFromRight(int distance) {

        AnimationSet animationSet = new AnimationSet(true);

        Animation step1 = new TranslateAnimation(Animation.ABSOLUTE,
                distance, Animation.ABSOLUTE, 720, Animation.ABSOLUTE, 0,
                Animation.ABSOLUTE, 0);/*from  w  w  w .j  a  va  2 s  .co m*/
        step1.setDuration(200);

        Animation step2 = new TranslateAnimation(Animation.ABSOLUTE, 100,
                Animation.ABSOLUTE, -720, Animation.ABSOLUTE, 0,
                Animation.ABSOLUTE, 0);
        step2.setDuration(400);

        animationSet.addAnimation(step1);
        animationSet.addAnimation(step2);
        animationSet.setInterpolator(new BounceInterpolator());
        return animationSet;

    }
}

Related Tutorials