Example usage for android.animation ObjectAnimator setDuration

List of usage examples for android.animation ObjectAnimator setDuration

Introduction

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

Prototype

@Override
@NonNull
public ObjectAnimator setDuration(long duration) 

Source Link

Document

Sets the length of the animation.

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();/*from ww  w  .  j  ava  2s. c o m*/
    return animator;
}

From source file:Main.java

public static ObjectAnimator alpha(View view, int duration) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f);
    animator.setDuration(duration);
    return animator;
}

From source file:Main.java

public static void startRotateAnimation(View v, int duration) {
    ObjectAnimator oa = ObjectAnimator.ofFloat(v, "rotation", 0f, 360f);
    oa.setDuration(duration);
    oa.setInterpolator(null);/*ww w  . j  av  a 2 s  .c  o m*/
    oa.setRepeatCount(ValueAnimator.INFINITE);
    oa.start();
}

From source file:Main.java

public static void alpha(View view, float from, float to, int duration) {
    ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", from, to);
    alpha.setDuration(duration);
    alpha.start();//from   ww  w. ja v a2 s . co  m
}

From source file:Main.java

public static void twinkle(View view) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "alpha", 1, 0.2f, 1);
    animator.setDuration(300);
    animator.start();/*from www .j a  v a 2  s  . c  om*/
}

From source file:Main.java

public static void startAnim(View view) {
    view.clearAnimation();/*from  w w w  . ja  va 2  s  .c  o  m*/
    ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0.2f, 1f);
    scaleY.setDuration(300);
    scaleY.start();
}

From source file:Main.java

public static ObjectAnimator rotation(View view, int duration) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotation", 0f, 360f);
    animator.setDuration(duration);
    return animator;
}

From source file:Main.java

public static ObjectAnimator scaleX(View view, int duration) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, SCALE_X, 1f, 2f, 1f);
    animator.setDuration(duration);
    return animator;
}

From source file:Main.java

private static ObjectAnimator animateFloatProperty(Object target, String propertyName, int time,
        float... value) {
    ObjectAnimator oa = ObjectAnimator.ofFloat(target, propertyName, value);
    oa.setDuration(time);
    return oa;//from   w w  w  .j a  v a  2  s.co  m
}

From source file:Main.java

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