Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;

import android.widget.TextView;

public class Main {
    private static TextView text;
    private static AnimatorSet animatorSet;
    private static boolean isAiming;

    private static void initAnim() {

        animatorSet = new AnimatorSet();
        animatorSet.setDuration(500);

        ObjectAnimator x = ObjectAnimator.ofFloat(text, "scaleX", 0.3f, 1f);
        ObjectAnimator y = ObjectAnimator.ofFloat(text, "scaleY", 0.3f, 1f);
        ObjectAnimator a = ObjectAnimator.ofFloat(text, "alpha", 0.3f, 1f);

        animatorSet.play(x).with(y).with(a);
        animatorSet.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {
                isAiming = true;
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                isAiming = false;
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                isAiming = false;
            }

            @Override
            public void onAnimationRepeat(Animator animation) {
                isAiming = true;
            }
        });
    }
}