Example usage for android.animation ObjectAnimator start

List of usage examples for android.animation ObjectAnimator start

Introduction

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

Prototype

@Override
    public void start() 

Source Link

Usage

From source file:Main.java

public static void arrowUpAnim(View view) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotation", 0f, 180f);
    animator.setDuration(400);/*from w  w w  .  ja v a 2 s. 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);//  w  w  w. j a va 2 s  . c o  m
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.start();
}

From source file:Main.java

public static void startRotateAnimation(View v, int duration) {
    ObjectAnimator oa = ObjectAnimator.ofFloat(v, "rotation", 0f, 360f);
    oa.setDuration(duration);//from  w w  w  . ja  v a2s  .c  o m
    oa.setInterpolator(null);
    oa.setRepeatCount(ValueAnimator.INFINITE);
    oa.start();
}

From source file:Main.java

public static void showBackgroundColorAnimation(View view, int preColor, int currColor, int duration) {
    ObjectAnimator animator = ObjectAnimator.ofInt(view, "backgroundColor", new int[] { preColor, currColor });
    animator.setDuration(duration);//  w  ww .ja  v  a 2s .  c  o m
    animator.setEvaluator(new ArgbEvaluator());
    animator.start();
}

From source file:Main.java

public static void spinOnceX(View view, int cameraDistance, int duration, boolean forward) {
    view.setCameraDistance(cameraDistance);

    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotationX", 0.0f, forward ? 360.0f : -360.0f);
    animator.setRepeatMode(ObjectAnimator.REVERSE);
    animator.setDuration(duration);/*from  w  w  w  . j a  v  a  2  s  .com*/
    animator.start();
}

From source file:Main.java

/**
 * shake x//  w  w  w  .j av  a  2s  .c o  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 w w  w  .  j  a v  a  2s  .com*/
 *
 * @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 showCardBackgroundColorAnimation(View view, int preColor, int currColor, int duration) {
    ObjectAnimator animator = ObjectAnimator.ofInt(view, "cardBackgroundColor",
            new int[] { preColor, currColor });
    animator.setDuration(duration);//from ww  w. j av a 2  s .  co m
    animator.setEvaluator(new ArgbEvaluator());
    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  ww  w  . j  a v a2  s . c  om
    animator.setRepeatCount(2);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.start();
}

From source file:Main.java

public static ObjectAnimator animateTranslateX(final View view, float initialX, float finalX, int duration,
        int delay) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "TranslationX", initialX, finalX);
    animator.setDuration(duration);//w ww .  j  a v a  2 s .  com
    if (delay > 0)
        animator.setStartDelay(delay);

    // go for it
    animator.start();

    return animator;
}