Android examples for Animation:Alpha Fly Animation
Create fly in From Right Alpha Animation
//package com.java2s; import android.view.animation.AccelerateInterpolator; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.TranslateAnimation; public class Main { public static Animation inFromRightAlphaAnimation() { AnimationSet set = new AnimationSet(true); set.addAnimation(inFromRightAnimation()); set.addAnimation(inAlphaAnimation()); return set; }/* ww w. j ava2s . c o m*/ public static Animation inFromRightAnimation() { Animation inFromRight = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); inFromRight.setDuration(350); inFromRight.setInterpolator(new AccelerateInterpolator()); return inFromRight; } public static Animation inAlphaAnimation() { AlphaAnimation alpha = new AlphaAnimation(0.0f, 1.0f); alpha.setDuration(1000); alpha.setInterpolator(new AccelerateInterpolator()); return alpha; } }