Example usage for android.view.animation Animation setInterpolator

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

Introduction

In this page you can find the example usage for android.view.animation Animation 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 Animation createForeverReverseRotationAnimation() {
    Animation mRotateAnimation = new RotateAnimation(720, 0, Animation.RESTART, 0.5f, Animation.RESTART, 0.5f);
    mRotateAnimation.setInterpolator(new LinearInterpolator());
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
    mRotateAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    return mRotateAnimation;
}

From source file:com.byoutline.kickmaterial.utils.LUtils.java

public static Animation loadAnimationWithLInterpolator(Context context, @AnimRes int animId,
        android.view.animation.Interpolator interpolator) {
    Animation animation = AnimationUtils.loadAnimation(context, animId);
    animation.setInterpolator(interpolator);
    return animation;
}

From source file:Main.java

public static Animation createForeverRotationAnimation() {
    Animation mRotateAnimation = new RotateAnimation(0, 1080, Animation.RESTART, 0.5f, Animation.RESTART, 0.5f);
    mRotateAnimation.setInterpolator(new LinearInterpolator());
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
    mRotateAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    return mRotateAnimation;
}

From source file:Main.java

public static Animation getFadeInAnimation(int durationInMilliseconds) {
    Animation fadeIn = new AlphaAnimation(0, 1);
    fadeIn.setFillAfter(true);/*w  ww  . jav a 2s  .co m*/
    fadeIn.setInterpolator(new AccelerateInterpolator());
    fadeIn.setDuration(durationInMilliseconds);
    return fadeIn;
}

From source file:Main.java

public static void animaBotao(Button botao) {
    final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
    animation.setDuration(400);//from w w w .j  a  v a  2 s .c  o  m
    animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
    animation.setRepeatCount(2);
    animation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in
    botao.startAnimation(animation);
}

From source file:Main.java

public static void setFlickerAnimation(View v) {
    final Animation animation = new AlphaAnimation(1, 0); // Change alpha
    animation.setDuration(500); // duration - half a second
    animation.setInterpolator(new LinearInterpolator()); // do not alter
                                                         // animation
                                                         // rate
    animation.setRepeatCount(Animation.INFINITE); // Repeat animation
                                                  // infinitely
    animation.setRepeatMode(Animation.REVERSE); //
    v.setAnimation(animation);//from w  w  w .  j  a va  2s  . c  om
}

From source file:Main.java

public static Animation getScaleAnimation_see_all() {
    Animation animation = new ScaleAnimation(1.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 0f);
    animation.setInterpolator(new DecelerateInterpolator());
    animation.setDuration(200);/*w  w  w  . ja v  a  2 s  .c o m*/
    return animation;
}

From source file:Main.java

public static void linearAnimation(final View view, final int startX, final int startY, final int endX,
        final int endY, long duration, final Runnable callback) {
    Animation anim = new TranslateAnimation(startX, endX, startY, endY);
    anim.setDuration(duration);//w  ww. j  a  v a 2  s  .c  om
    anim.setInterpolator(new DecelerateInterpolator());
    view.startAnimation(anim);

    anim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            view.clearAnimation();
            view.setX(view.getX() + endX);
            view.setY(view.getY() + endY);

            if (callback != null)
                callback.run();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
}

From source file:Main.java

public static Animation getFadeOutAnimation(int durationInMilliseconds) {
    Animation fadeOut = new AlphaAnimation(1, 0);
    fadeOut.setFillAfter(true);/*from w ww  .  j  a va  2s .c o  m*/
    fadeOut.setInterpolator(new AccelerateInterpolator());
    fadeOut.setDuration(durationInMilliseconds);
    return fadeOut;
}

From source file:com.geekandroid.sdk.ClearEditText.java

/**
 * /*  w w w. ja v  a  2 s  .  co m*/
 * @param counts 1
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}