Create animate Rotation Animator - Android android.animation

Android examples for android.animation:Animator

Description

Create animate Rotation Animator

Demo Code


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

import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.view.View;

public class Main {
    public static Animator animRotation(View paramView, int duration) {
        ObjectAnimator localObjectAnimator = ObjectAnimator.ofFloat(
                paramView, "rotation", 0f, 360f);
        localObjectAnimator.setDuration(duration);
        localObjectAnimator.setRepeatCount(ValueAnimator.INFINITE);
        localObjectAnimator.setRepeatMode(ValueAnimator.INFINITE);
        localObjectAnimator.start();//from   w w w. j  a  v a2 s  . com
        return localObjectAnimator;
    }
}

Related Tutorials