Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;

import android.view.animation.OvershootInterpolator;
import android.view.animation.RotateAnimation;

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<Animation> initAnimation(int AnimationType, float fromAlpha, float toAlpha,
            float fromDegress, float toDegress, float pinX, float pinY) {
        List<Animation> animations = new ArrayList<>();
        AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha);
        alphaAnimation.setDuration(300);
        AlphaAnimation exit_alphaAnimation = new AlphaAnimation(toAlpha, fromAlpha);
        exit_alphaAnimation.setDuration(300);
        OvershootInterpolator overshootInterpolator = new OvershootInterpolator(3.5f);
        RotateAnimation rotateAnimation = new RotateAnimation(fromDegress, toDegress, AnimationType, pinX,
                AnimationType, pinY);
        rotateAnimation.setDuration(300);
        rotateAnimation.setInterpolator(overshootInterpolator);
        rotateAnimation.setFillAfter(true);
        RotateAnimation exit_rotateAnimation = new RotateAnimation(toDegress, fromAlpha, AnimationType, pinX,
                AnimationType, pinY);
        exit_rotateAnimation.setDuration(300);
        exit_rotateAnimation.setInterpolator(overshootInterpolator);
        exit_rotateAnimation.setFillAfter(true);
        animations.add(alphaAnimation);
        animations.add(exit_alphaAnimation);
        animations.add(rotateAnimation);
        animations.add(exit_rotateAnimation);
        return animations;
    }
}