Example usage for android.view.animation RotateAnimation setInterpolator

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

Introduction

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

Prototype

public void setInterpolator(Interpolator i) 

Source Link

Document

Sets the acceleration curve for this animation.

Usage

From source file:Main.java

public static void rotate0to180(View view) {
    RotateAnimation rotate = new RotateAnimation(0, 180, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    rotate.setDuration(ANIM);//from ww w . j  a  va 2  s  .  c  om
    rotate.setInterpolator(new LinearInterpolator());
    rotate.setFillAfter(true);
    view.startAnimation(rotate);
}

From source file:Main.java

public static void rotate180to360(View view) {
    RotateAnimation rotate = new RotateAnimation(180, 360, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    rotate.setDuration(ANIM);//from w w  w.  j  a v  a2s .  c  o  m
    rotate.setInterpolator(new LinearInterpolator());
    rotate.setFillAfter(true);
    view.startAnimation(rotate);
}

From source file:Main.java

public static Animation getRotateAnimation() {
    final RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, .5f,
            Animation.RELATIVE_TO_SELF, .5f);
    rotateAnimation.setDuration(1500);/*from w w  w  . j  a v  a 2s.  c  om*/
    rotateAnimation.setInterpolator(new LinearInterpolator());
    rotateAnimation.setRepeatCount(Animation.INFINITE);
    return rotateAnimation;
}

From source file:Main.java

public static List<Animation> initAnimation(int AnimationType, float fromAlpha, float toAlpha,
        float fromDegress, float toDegress, float pinX, float pinY) {
    List<Animation> animations = new ArrayList<>();
    AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha);
    alphaAnimation.setDuration(300);/*from w ww  .  j a va  2s. co  m*/
    AlphaAnimation exit_alphaAnimation = new AlphaAnimation(toAlpha, fromAlpha);
    exit_alphaAnimation.setDuration(300);
    OvershootInterpolator overshootInterpolator = new OvershootInterpolator(3.5f);
    RotateAnimation rotateAnimation = new RotateAnimation(fromDegress, toDegress, AnimationType, pinX,
            AnimationType, pinY);
    rotateAnimation.setDuration(300);
    rotateAnimation.setInterpolator(overshootInterpolator);
    rotateAnimation.setFillAfter(true);
    RotateAnimation exit_rotateAnimation = new RotateAnimation(toDegress, fromAlpha, AnimationType, pinX,
            AnimationType, pinY);
    exit_rotateAnimation.setDuration(300);
    exit_rotateAnimation.setInterpolator(overshootInterpolator);
    exit_rotateAnimation.setFillAfter(true);
    animations.add(alphaAnimation);
    animations.add(exit_alphaAnimation);
    animations.add(rotateAnimation);
    animations.add(exit_rotateAnimation);
    return animations;
}

From source file:Main.java

public static AnimationSet RotateAndFadeOutAnimation() {
    AlphaAnimation fade_out = new AlphaAnimation(1f, 0.2f);
    fade_out.setDuration(500);/*from w  ww .  ja v a2  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;
}

From source file:Main.java

public static void startRepeatSelfRotateAnimation(View v, long duration, Animation.AnimationListener listener) {
    RotateAnimation animation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(duration);/*w  w w.j a  v a  2s .  co m*/
    animation.setRepeatCount(-1); // Repeat animation
    animation.setFillAfter(true);
    animation.setRepeatMode(Animation.INFINITE); //
    LinearInterpolator lir = new LinearInterpolator();
    animation.setInterpolator(lir);
    if (listener != null) {
        animation.setAnimationListener(listener);
    }
    v.startAnimation(animation);
}

From source file:org.videolan.vlc.gui.helpers.UiTools.java

public static void fillAboutView(View v) {
    TextView link = (TextView) v.findViewById(R.id.main_link);
    link.setText(Html.fromHtml(VLCApplication.getAppResources().getString(R.string.about_link)));

    String revision = VLCApplication.getAppResources().getString(R.string.build_revision) + " VLC: "
            + VLCApplication.getAppResources().getString(R.string.build_vlc_revision);
    String builddate = VLCApplication.getAppResources().getString(R.string.build_time);
    String builder = VLCApplication.getAppResources().getString(R.string.build_host);

    TextView compiled = (TextView) v.findViewById(R.id.main_compiled);
    compiled.setText(builder + " (" + builddate + ")");
    TextView textview_rev = (TextView) v.findViewById(R.id.main_revision);
    textview_rev.setText(VLCApplication.getAppResources().getString(R.string.revision) + " " + revision + " ("
            + builddate + ") " + BuildConfig.FLAVOR_abi);

    final ImageView logo = (ImageView) v.findViewById(R.id.logo);
    logo.setOnClickListener(new View.OnClickListener() {
        @Override/*w  ww .ja v  a  2 s  . c o m*/
        public void onClick(View v) {
            AnimationSet anim = new AnimationSet(true);
            RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f,
                    Animation.RELATIVE_TO_SELF, 0.5f);
            rotate.setDuration(800);
            rotate.setInterpolator(new DecelerateInterpolator());
            anim.addAnimation(rotate);
            logo.startAnimation(anim);
        }
    });
}

From source file:Main.java

public static RotateAnimation getRotateAnimation(float fromAngle, float toAngle, float pivotX, float pivotY,
        int intDuration, int intRepeatCount, boolean boolFillAfter) {
    RotateAnimation mAnmation = new RotateAnimation(fromAngle, toAngle, Animation.RELATIVE_TO_SELF, pivotX,
            Animation.RELATIVE_TO_SELF, pivotY);
    mAnmation.setDuration(intDuration);/*from   ww  w .ja  v  a  2  s .c  o m*/
    mAnmation.setFillAfter(boolFillAfter);
    if (intRepeatCount != 1) {
        mAnmation.setRepeatMode(Animation.RESTART);
        mAnmation.setRepeatCount(intRepeatCount);
    }
    // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    mAnmation.setInterpolator(new LinearInterpolator());
    return mAnmation;
}

From source file:Main.java

public static void setRotateAnimation(View view, float fromAngle, float toAngle, float pivotX, float pivotY,
        int intDuration, int intRepeatCount, boolean boolFillAfter) {
    RotateAnimation mAnmation = new RotateAnimation(fromAngle, toAngle, Animation.RELATIVE_TO_SELF, pivotX,
            Animation.RELATIVE_TO_SELF, pivotY);
    mAnmation.setDuration(intDuration);/*from w ww.  j  a v a  2 s.  c  o  m*/
    mAnmation.setFillAfter(boolFillAfter);
    if (intRepeatCount != 1) {
        mAnmation.setRepeatMode(Animation.RESTART);
        mAnmation.setRepeatCount(intRepeatCount);
    }
    // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    mAnmation.setInterpolator(new LinearInterpolator());
    view.startAnimation(mAnmation);
}

From source file:org.tomahawk.tomahawk_android.utils.AdapterUtils.java

private static RotateAnimation constructRotateAnimation() {
    final RotateAnimation animation = new RotateAnimation(0.0f, 360.0f, RotateAnimation.RELATIVE_TO_SELF, 0.49f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(1500);//from ww w .  j  a v  a  2  s  .com
    animation.setInterpolator(new LinearInterpolator());
    animation.setRepeatCount(RotateAnimation.INFINITE);
    return animation;
}