Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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.LinearInterpolator;

import android.view.animation.RotateAnimation;
import android.view.animation.ScaleAnimation;

public class Main {
    public static AnimationSet RotateAndFadeOutAnimation() {
        AlphaAnimation fade_out = new AlphaAnimation(1f, 0.2f);
        fade_out.setDuration(500);
        fade_out.setStartOffset(0);
        fade_out.setFillAfter(true);

        ScaleAnimation shrink = new ScaleAnimation(1f, 0.2f, 1f, 0.2f, Animation.RELATIVE_TO_SELF, .5f,
                Animation.RELATIVE_TO_SELF, .5f);
        shrink.setDuration(400);
        shrink.setStartOffset(0);
        shrink.setFillAfter(true);

        RotateAnimation rotate = new RotateAnimation(0.0f, 360f, Animation.RELATIVE_TO_SELF, .5f,
                Animation.RELATIVE_TO_SELF, .5f);
        rotate.setDuration(500);
        rotate.setStartOffset(0);
        rotate.setInterpolator(new LinearInterpolator());
        rotate.setFillAfter(true);

        AnimationSet Reload = new AnimationSet(true);
        Reload.addAnimation(fade_out);
        Reload.addAnimation(shrink);
        Reload.addAnimation(rotate);
        Reload.setInterpolator(new AccelerateInterpolator(1.1f));

        return Reload;
    }
}