get Self Rotate Animation from parameter passed in - Android Animation

Android examples for Animation:Rotate Animation

Description

get Self Rotate Animation from parameter passed in

Demo Code


//package com.java2s;

import android.view.animation.Animation;

import android.view.animation.Interpolator;

import android.view.animation.RotateAnimation;

public class Main {

    public static RotateAnimation getSelfRotateAnimation(float fromDegrees,
            float toDegrees, long durationMillis, long startOffset,
            Interpolator i) {/* w  w  w. j  av  a  2  s.c  o m*/
        RotateAnimation animation = new RotateAnimation(fromDegrees,
                toDegrees, Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        animation.setDuration(durationMillis);
        animation.setStartOffset(startOffset);
        animation.setFillAfter(true);
        animation.setInterpolator(i);
        return animation;
    }
}

Related Tutorials