get Rotate Animator - Android android.animation

Android examples for android.animation:Animator

Description

get Rotate Animator

Demo Code


//package com.java2s;

import android.animation.ObjectAnimator;

import android.support.annotation.NonNull;

import android.view.View;

import android.view.animation.Animation;

public class Main {
    @NonNull/*from   w w  w  .j  a va  2  s  .c o  m*/
    public static ObjectAnimator getRotateAnimator(View view,
            long duration, int repeatCount) {
        final ObjectAnimator rotate = ObjectAnimator.ofFloat(view,
                "rotation", 0, 360);
        rotate.setDuration(duration);
        rotate.setRepeatCount(repeatCount);
        rotate.setRepeatMode(Animation.INFINITE);
        return rotate;
    }
}

Related Tutorials