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

public static void enlargeToRight(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(0.8f, 1f, 0.8f, 1f, pivotX, pivotY);
    anim.setInterpolator(new LinearInterpolator());
    anim.setDuration(200);//from   w ww  . jav  a2 s  .  co 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);
}

From source file:Main.java

public static AnimationSet RotateAndFadeOutAnimation() {
    AlphaAnimation fade_out = new AlphaAnimation(1f, 0.2f);
    fade_out.setDuration(500);// w w w.ja  v a 2  s .  c om
    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:com.savvasdalkitsis.betwixt.Interpolators.java

/**
 * <strong>ANDROID INTERPOLATOR</strong><br/><br/>
 * A linear interpolator. This returns the value passed in
 *///w  ww. j  av  a  2 s.  c  o  m
@NonNull
public static Interpolator linear() {
    return new LinearInterpolator();
}

From source file:eu.sathra.io.adapters.InterpolatorAdapter.java

public InterpolatorAdapter() {
    mInterpolators.put(INTERPOLATOR_LINEAR, new LinearInterpolator());
}

From source file:eu.inmite.apps.smsjizdenka.util.AnimationUtil.java

public static void setFlipAnimation(final ImageView view, final ObjectAnimator animator, final int firstImage,
        final int secondImage, final Context c) {
    if (secondImage == NO_ANIMATION) {
        view.setImageResource(firstImage);
        animator.end();//from  ww  w.j  a v  a  2  s .  com
        ViewCompat.setHasTransientState(view, false);
    } else {
        animator.setRepeatCount(ObjectAnimator.INFINITE);
        animator.setDuration(1300);
        animator.setInterpolator(new LinearInterpolator());
        animator.setRepeatMode(ValueAnimator.RESTART);

        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            final Drawable shape1 = c.getResources().getDrawable(firstImage);
            final Drawable shape2 = c.getResources().getDrawable(secondImage);
            Drawable currentDrawable = null;

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float angle = (Float) animation.getAnimatedValue();
                int quadrant = (int) (angle / 90) + 1;
                if ((quadrant == 1 || quadrant == 4) && shape1 != currentDrawable) {
                    view.setImageDrawable(shape1);
                    currentDrawable = shape1;
                } else if ((quadrant == 2 || quadrant == 3) && currentDrawable != shape2) {
                    view.setImageDrawable(shape2);
                    currentDrawable = shape2;
                }
            }
        });
        animator.start();
        ViewCompat.setHasTransientState(view, true);
    }
}

From source file:net.semantic_error.turritype.TurriType.java

private static WriteRequest getDefaultWriteRequest(@NonNull String text) {
    checkNotNull(text, "text == null");
    return new WriteRequest(text, NORMAL_SPEED, new LinearInterpolator(), null, null, new NoPauseStrategy());
}

From source file:ru.annin.store.presentation.ui.behavior.FabFloat.java

@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target,
        int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
    if (dyConsumed > 0) {
        CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
        int fabBottomMargin = layoutParams.bottomMargin;
        child.animate().translationY((float) (child.getHeight() + fabBottomMargin))
                .setInterpolator(new LinearInterpolator()).setDuration(150);
    } else if (dyConsumed < 0) {
        child.animate().translationY(0.0f).setInterpolator(new LinearInterpolator()).setDuration(150);
    }/*w  ww  .  j  a  va 2s. co  m*/
}

From source file:com.bachhuberdesign.deckbuildergwent.util.AnimUtils.java

@NonNull
public static Interpolator getLinearInterpolator() {
    if (linear == null) {
        linear = new LinearInterpolator();
    }/*  w w w  . j a  v  a2s .  co m*/
    return linear;
}

From source file:zjut.soft.finalwork.fragment.RightFragment.java

@Override
public void onResume() {
    super.onResume();
    RotateAnimation anim = (RotateAnimation) AnimationUtils.loadAnimation(getActivity(),
            R.anim.gear_turning_around);
    anim.setRepeatCount(Animation.INFINITE);
    anim.setInterpolator(new LinearInterpolator());
    gearIV.startAnimation(anim);/*from   ww  w.  j a v a2 s .  co  m*/
    plannerScaleAction();

}

From source file:com.guodong.sun.guodong.behavior.FabHideOnScroll.java

@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target,
        int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);

    // child -> Floating Action Button
    if (dyConsumed > 0) {
        CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
        int fabBottomMargin = layoutParams.bottomMargin;
        child.animate().translationY(child.getHeight() + fabBottomMargin)
                .setInterpolator(new LinearInterpolator()).start();
    } else if (dyConsumed < 0) {
        child.animate().translationY(0).setInterpolator(new LinearInterpolator()).start();
    }/*from   w w w.  ja v  a 2s  .c o m*/
}