Example usage for android.view.animation RotateAnimation setStartOffset

List of usage examples for android.view.animation RotateAnimation setStartOffset

Introduction

In this page you can find the example usage for android.view.animation RotateAnimation setStartOffset.

Prototype

public void setStartOffset(long startOffset) 

Source Link

Document

When this animation should start relative to the start time.

Usage

From source file:Main.java

public static RotateAnimation getRotateAnimation() {
    RotateAnimation ra = new RotateAnimation(0.0f, 360.0f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    ra.setDuration(1000);//from ww  w.jav  a 2 s.  c o  m
    ra.setStartOffset(0);
    ra.setRepeatCount(Animation.INFINITE);
    return ra;
}

From source file:Main.java

public static void rotateOutAnimation(RelativeLayout level, long i) {
    RotateAnimation animation = new RotateAnimation(0, 180, level.getWidth() / 2, level.getHeight());
    animation.setFillAfter(true);/*from   ww  w  .j ava 2s  .c om*/
    animation.setDuration(500);
    animation.setStartOffset(i);
    level.startAnimation(animation);
}

From source file:Main.java

public static void rotateInAnimation(RelativeLayout level, long i) {
    RotateAnimation animation = new RotateAnimation(180, 360, level.getWidth() / 2, level.getHeight());
    animation.setFillAfter(true);//ww w  .  j av  a2s .  c om
    animation.setDuration(500);
    animation.setStartOffset(i);
    level.startAnimation(animation);
}

From source file:Main.java

public static AnimationSet RotateAndFadeInAnimation() {

    AlphaAnimation fade_in = new AlphaAnimation(0.2f, 1f);
    fade_in.setDuration(400);/*from   w  w w . jav a  2  s .c o  m*/
    fade_in.setStartOffset(0);
    fade_in.setFillAfter(true);

    ScaleAnimation expand = new ScaleAnimation(0.2f, 1, 0.2f, 1, Animation.RELATIVE_TO_SELF, .5f,
            Animation.RELATIVE_TO_SELF, .5f);
    expand.setDuration(500);
    expand.setStartOffset(0);
    expand.setFillAfter(true);

    RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, .5f,
            Animation.RELATIVE_TO_SELF, .5f);
    rotate.setDuration(500);
    rotate.setStartOffset(0);
    // rotate.setInterpolator(new LinearInterpolator());
    rotate.setFillAfter(true);

    AnimationSet Reload = new AnimationSet(true);
    Reload.addAnimation(fade_in);
    Reload.addAnimation(expand);
    Reload.addAnimation(rotate);
    Reload.setInterpolator(new DecelerateInterpolator(1.3f));
    return Reload;
}

From source file:Main.java

public static AnimationSet RotateAndFadeOutAnimation() {
    AlphaAnimation fade_out = new AlphaAnimation(1f, 0.2f);
    fade_out.setDuration(500);/*from w w w  .  j a  va 2 s . co m*/
    fade_out.setStartOffset(0);
    fade_out.setFillAfter(true);

    ScaleAnimation shrink = new ScaleAnimation(1f, 0.2f, 1f, 0.2f, Animation.RELATIVE_TO_SELF, .5f,
            Animation.RELATIVE_TO_SELF, .5f);
    shrink.setDuration(400);
    shrink.setStartOffset(0);
    shrink.setFillAfter(true);

    RotateAnimation rotate = new RotateAnimation(0.0f, 360f, Animation.RELATIVE_TO_SELF, .5f,
            Animation.RELATIVE_TO_SELF, .5f);
    rotate.setDuration(500);
    rotate.setStartOffset(0);
    rotate.setInterpolator(new LinearInterpolator());
    rotate.setFillAfter(true);

    AnimationSet Reload = new AnimationSet(true);
    Reload.addAnimation(fade_out);
    Reload.addAnimation(shrink);
    Reload.addAnimation(rotate);
    Reload.setInterpolator(new AccelerateInterpolator(1.1f));

    return Reload;
}