create Zoom In Away Animation - Android Animation

Android examples for Animation:Scale Animation

Description

create Zoom In Away Animation

Demo Code


//package com.java2s;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.DecelerateInterpolator;

import android.view.animation.ScaleAnimation;

public class Main {
    private static final long MEDIUM = 500;

    public static Animation createZoomInAwayAnim() {
        AnimationSet ret;/*from  w w  w  .  ja v  a2s. c o m*/
        Animation anim;
        ret = new AnimationSet(false);

        anim = new AlphaAnimation(1f, 0f);
        anim.setDuration(MEDIUM);
        anim.setInterpolator(new DecelerateInterpolator());
        ret.addAnimation(anim);

        anim = new ScaleAnimation(1, 3, 1, 3, Animation.RELATIVE_TO_SELF,
                0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        anim.setDuration(MEDIUM);
        anim.setInterpolator(new DecelerateInterpolator());
        ret.addAnimation(anim);

        return ret;
    }
}

Related Tutorials