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 ObjectAnimator animateMove(Object target, int x, int y, long duration, long startDelay) {
    ObjectAnimator animator = getAnimator(target);
    animator.setDuration(duration).setStartDelay(startDelay);

    animator.setValues(PropertyValuesHolder.ofInt("x", x), PropertyValuesHolder.ofInt("y", y));

    animator.start();
    return animator;
}

From source file:Main.java

public static void doSimpleRefresh(Object view) {
    LinearInterpolator interpolator = new LinearInterpolator();
    ObjectAnimator refreshAnimator = ObjectAnimator.ofFloat(view, "rotation", 0f, 360f);
    refreshAnimator.setInterpolator(interpolator);
    refreshAnimator.setDuration(300);/*ww w.j  ava  2s  .c o  m*/
    refreshAnimator.setRepeatCount(3);
    refreshAnimator.start();
}

From source file:Main.java

public static void spinForever(View view, int cameraDistance, int duration) {
    view.setCameraDistance(cameraDistance);

    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotationY", 0.0f, 360.0f);
    animator.setRepeatMode(ObjectAnimator.REVERSE);
    animator.setRepeatCount(ObjectAnimator.INFINITE);
    animator.setDuration(duration);//from www .j  a v  a 2s  .c  o  m
    animator.start();
}

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 w  w  w  .j ava  2 s  . co  m*/
    refreshAnimator.setRepeatCount(repeat);
    refreshAnimator.start();
}

From source file:Main.java

public static void showBackgroundColorAnimation(View view, int preColor, int currColor, int duration) {
    ObjectAnimator localObjectAnimator = ObjectAnimator.ofInt(view, "backgroundColor",
            new int[] { preColor, currColor });
    localObjectAnimator.setDuration(duration);
    localObjectAnimator.setEvaluator(new ArgbEvaluator());
    localObjectAnimator.start();
}

From source file:Main.java

/**
 * scale y/*  w ww .j  a va  2 s  .c  o m*/
 *
 * @param v
 * @param fromY
 * @param toY
 * @param duration
 * @param animatorListener
 */
public static void scaleY(View v, float fromY, float toY, int duration,
        Animator.AnimatorListener animatorListener) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.SCALE_Y, fromY, toY);
    animator.setDuration(duration);
    if (animatorListener != null) {
        animator.addListener(animatorListener);
    }
    animator.start();
}

From source file:Main.java

/**
 * scale x//from   w  ww. ja  va2 s  . c o  m
 *
 * @param v
 * @param fromX
 * @param toX
 * @param duration
 * @param animatorListener
 */
public static void scaleX(View v, float fromX, float toX, int duration,
        Animator.AnimatorListener animatorListener) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.SCALE_X, fromX, toX);
    animator.setDuration(duration);
    if (animatorListener != null) {
        animator.addListener(animatorListener);
    }
    animator.start();
}

From source file:Main.java

/**
 * rotation y//  w ww. java  2 s .  co m
 *
 * @param v
 * @param fromY
 * @param toY
 * @param duration
 * @param animatorListener
 */
public static void rotationY(View v, float fromY, float toY, int duration,
        Animator.AnimatorListener animatorListener) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.ROTATION_Y, fromY, toY);
    animator.setDuration(duration);
    if (animatorListener != null) {
        animator.addListener(animatorListener);
    }
    animator.start();
}

From source file:Main.java

/**
 * rotation x//from   w ww .j  a  v a 2  s  .c o  m
 *
 * @param v
 * @param fromX
 * @param toX
 * @param duration
 * @param animatorListener
 */
public static void rotationX(View v, float fromX, float toX, int duration,
        Animator.AnimatorListener animatorListener) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.ROTATION_X, fromX, toX);
    animator.setDuration(duration);
    if (animatorListener != null) {
        animator.addListener(animatorListener);
    }
    animator.start();
}

From source file:Main.java

/**
 * alpha// w w w  .j av  a  2 s.c o m
 *
 * @param v
 * @param fromAlpha
 * @param toAlpha
 * @param duration
 * @param animatorListener
 */
public static void alpha(View v, float fromAlpha, float toAlpha, int duration,
        Animator.AnimatorListener animatorListener) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.ALPHA, fromAlpha, toAlpha);
    animator.setDuration(duration);
    if (animatorListener != null) {
        animator.addListener(animatorListener);
    }
    animator.start();
}