Create fly in From Bottom Alpha Animation with relative to parent - Android Animation

Android examples for Animation:Alpha Fly Animation

Description

Create fly in From Bottom Alpha Animation with relative to parent

Demo Code


//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 inFromBottomAlphaAnimation() {
        AnimationSet set = new AnimationSet(true);

        set.addAnimation(inFromBottomAnimation());
        set.addAnimation(inAlphaAnimation());

        return set;
    }//from  w  w w .  j a va 2s .  c o  m

    public static Animation inFromBottomAnimation() {
        Animation inFromLeft = new TranslateAnimation(
                Animation.RELATIVE_TO_PARENT, 0.0f,
                Animation.RELATIVE_TO_PARENT, 0.0f,
                Animation.RELATIVE_TO_PARENT, +1.0f,
                Animation.RELATIVE_TO_PARENT, 0.0f);
        inFromLeft.setDuration(350);
        inFromLeft.setInterpolator(new AccelerateInterpolator());
        return inFromLeft;
    }

    public static Animation inAlphaAnimation() {
        AlphaAnimation alpha = new AlphaAnimation(0.0f, 1.0f);
        alpha.setDuration(1000);
        alpha.setInterpolator(new AccelerateInterpolator());
        return alpha;
    }
}

Related Tutorials