Example usage for android.animation ObjectAnimator setInterpolator

List of usage examples for android.animation ObjectAnimator setInterpolator

Introduction

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

Prototype

@Override
public void setInterpolator(TimeInterpolator value) 

Source Link

Document

The time interpolator used in calculating the elapsed fraction of this animation.

Usage

From source file:Main.java

public static void arrowUpAnim(View view) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotation", 0f, 180f);
    animator.setDuration(400);//w ww  .  j a v  a 2s .  c  o  m
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.start();
}

From source file:Main.java

public static void animation4(final View view) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", -100f);
    animator.setDuration(500);//from   w ww.  j  av  a 2 s  . c  om
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.start();
}

From source file:Main.java

public static ObjectAnimator createShowGradientAnimation(View view) {
    ObjectAnimator alphaAnimation = ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1f);
    alphaAnimation.setDuration(400);/*from w  w  w . ja  v  a  2s .co  m*/
    alphaAnimation.setInterpolator(new LinearInterpolator());
    return alphaAnimation;
}

From source file:Main.java

public static ObjectAnimator toastAlpha(View view, float alpha, int duration, Interpolator interpolator) {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "alpha", alpha);
    objectAnimator.setDuration(duration);
    objectAnimator.setInterpolator(interpolator);
    objectAnimator.start();/*from  ww w .j a va 2s.co m*/
    return objectAnimator;
}

From source file:Main.java

public static ObjectAnimator translateToastByX(View view, float x, int duration, Interpolator interpolator) {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "translationX", x);
    objectAnimator.setDuration(duration);
    objectAnimator.setInterpolator(interpolator);
    objectAnimator.start();/*from  w  w w . j a v a2 s.  c  o  m*/
    return objectAnimator;
}

From source file:Main.java

public static ObjectAnimator translateToastByY(View view, float y, int duration, Interpolator interpolator) {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "translationY", y);
    objectAnimator.setDuration(duration);
    objectAnimator.setInterpolator(interpolator);
    objectAnimator.start();/*from  w w  w  .j  av a2 s .c o  m*/
    return objectAnimator;
}

From source file:Main.java

public static Animator moveScrollViewToX(View view, int toX, int time, int delayTime, boolean isStart) {
    ObjectAnimator objectAnimator = ObjectAnimator.ofInt(view, "scrollX", new int[] { toX });
    objectAnimator.setDuration(time);/*from  w w w. j  a  v a2  s  .c o  m*/
    objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    objectAnimator.setStartDelay(delayTime);
    if (isStart)
        objectAnimator.start();
    return objectAnimator;
}

From source file:Main.java

/**
 * shake x/*from  ww w.  j av  a  2s. co m*/
 *
 * @param v
 * @param offset
 * @param duration
 * @param times
 */
public static void shakeX(View v, float offset, long duration, float times) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.TRANSLATION_X, 0, offset);
    animator.setDuration(duration);
    animator.setInterpolator(new CycleInterpolator(times));
    animator.start();
}

From source file:Main.java

/**
 * shake y/*from ww  w .ja  va  2s .c om*/
 *
 * @param v
 * @param offset
 * @param duration
 * @param times
 */
public static void shakeY(View v, float offset, long duration, float times) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.TRANSLATION_Y, 0, offset);
    animator.setDuration(duration);
    animator.setInterpolator(new CycleInterpolator(times));
    animator.start();
}

From source file:Main.java

public static void animation3(View view) {
    ObjectAnimator animator = new ObjectAnimator().ofFloat(view, "rotationY", 0.0f, 360f);
    animator.setDuration(4000);//from  w w w . j  a  va2  s  .c o m
    animator.setRepeatCount(2);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.start();
}