Create Rotate Animation - Android Animation

Android examples for Animation:Rotate Animation

Description

Create Rotate Animation

Demo Code


//package com.java2s;

import android.view.animation.Animation;

import android.view.animation.RotateAnimation;

public class Main {

    public static Animation getRotateAnimation(float fromDegrees,
            float toDegrees, long durationMillis) {
        RotateAnimation rotate = new RotateAnimation(fromDegrees,
                toDegrees, Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        rotate.setDuration(durationMillis);
        rotate.setFillAfter(true);/* w ww  .  j  a v  a  2  s  .  c o m*/
        return rotate;
    }
}

Related Tutorials