Example usage for android.view.animation LinearInterpolator LinearInterpolator

List of usage examples for android.view.animation LinearInterpolator LinearInterpolator

Introduction

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

Prototype

public LinearInterpolator() 

Source Link

Usage

From source file:Main.java

/**
 * Returns rotate animation that is set to refresh button to rotate refresh button.
 *  //  w w  w.j  a va 2 s  .  c o m
 * @return RotateAnimation
 */
public static RotateAnimation getRefreshButtonAnimation() {
    rotateAnim = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);
    rotateAnim.setDuration(800);
    rotateAnim.setInterpolator(new LinearInterpolator());
    rotateAnim.setInterpolator(new LinearInterpolator());
    rotateAnim.setRepeatCount(RotateAnimation.INFINITE);

    return rotateAnim;
}

From source file:Main.java

public static void doSimpleRefresh(Object view, int repeat) {
    LinearInterpolator interpolator = new LinearInterpolator();
    ObjectAnimator refreshAnimator = ObjectAnimator.ofFloat(view, "rotation", 0f, 360f);
    refreshAnimator.setInterpolator(interpolator);
    refreshAnimator.setDuration(300);//from ww  w  .j av a 2 s. co m
    refreshAnimator.setRepeatCount(repeat);
    refreshAnimator.start();
}

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);//from  ww w .  j a  v  a2  s.  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:Main.java

public static Interpolator getLinearInterpolator() {
    if (linear == null) {
        linear = new LinearInterpolator();
    }/*  w w  w .j a v a 2  s  . c  o  m*/
    return linear;
}

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   w w  w.  j  a va2s .  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 .ja  v a2s  .  c om
    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:Main.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void show(final View view, final int cornerType, int normalAnimRes,
        final AnimatorListenerAdapter listener) {
    try {/*from   ww  w. j ava2s.c o m*/
        int[] amaya = calulateCorner(view, cornerType);
        Animator anim = ViewAnimationUtils.createCircularReveal(view, amaya[0], amaya[1], 0, amaya[2]);
        anim.setInterpolator(new LinearInterpolator());
        anim.setDuration(300);
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
                super.onAnimationStart(animation);
                view.setVisibility(View.VISIBLE);
                if (listener != null) {
                    listener.onAnimationStart(animation);
                }
            }

        });
        anim.start();
    } catch (Exception e) {
        e.printStackTrace();
        view.setVisibility(View.VISIBLE);
    }
}

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 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:Main.java

public static void shrinkToLeft(FragmentActivity activity, View view, AnimationListener listener) {

    DisplayMetrics displaymetrics = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    int screenHeight = displaymetrics.heightPixels;
    int screenWidth = displaymetrics.widthPixels;

    AnimationSet animation = new AnimationSet(true);
    float pivotX = view.getWidth() / 2;
    float pivotY = view.getHeight() / 2;
    ScaleAnimation anim = new ScaleAnimation(1f, 0.8f, 1f, 0.8f, pivotX, pivotY);
    anim.setInterpolator(new LinearInterpolator());
    anim.setDuration(200);/*from  w ww .j  a  v  a2  s.c o m*/
    anim.setStartOffset(200);
    //anim.setFillAfter(true);
    animation.addAnimation(anim);

    TranslateAnimation animTrans = new TranslateAnimation(0.0f, (float) -(screenWidth - view.getWidth()), 0.0f,
            0.0f);
    anim.setInterpolator(new LinearInterpolator());
    animTrans.setDuration(400);
    //animTrans.setStartOffset(300);
    animation.addAnimation(animTrans);

    if (listener != null)
        animation.setAnimationListener(listener);

    view.startAnimation(animation);
}