Create rotation Animation with relative value - Android Animation

Android examples for Animation:Rotate Animation

Description

Create rotation Animation with relative value

Demo Code


//package com.java2s;

import android.view.animation.Animation;

import android.view.animation.RotateAnimation;

public class Main {
    public static Animation rotationAnimation() {
        final RotateAnimation rotate = new RotateAnimation(0f, 360f,
                Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        rotate.setDuration(600);/*from   ww  w.  j a  v a2  s .  c  o  m*/
        rotate.setRepeatMode(Animation.RESTART);
        rotate.setRepeatCount(Animation.INFINITE);
        return rotate;

    }
}

Related Tutorials