create Fast Rotate Animation - Android Animation

Android examples for Animation:Rotate Animation

Description

create Fast Rotate Animation

Demo Code


//package com.java2s;

import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;

import android.view.animation.RotateAnimation;

public class Main {
    public static Animation createFastRotateAnimation() {
        Animation rotate = new RotateAnimation(-2.0f, 2.0f,
                Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);

        rotate.setRepeatMode(Animation.REVERSE);
        rotate.setRepeatCount(Animation.INFINITE);
        rotate.setDuration(200);/*from  www.  j  ava2s.  c  o m*/
        rotate.setInterpolator(new AccelerateDecelerateInterpolator());

        return rotate;
    }
}

Related Tutorials