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

From source file:Main.java

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

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   w  w  w . j a v  a 2  s. c  o  m
    return objectAnimator;
}

From source file:Main.java

public static void alphaShow(@NonNull final View view) {
    if (view.getWindowToken() == null)
        return;//www.  j a va 2 s  .c o  m
    view.setVisibility(View.VISIBLE);
    ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f);
    alpha.setDuration(DURATION_MID);
    alpha.start();
}

From source file:Main.java

public static void startRotationY(View view, float begin, float end, int durtion) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotationY", begin, end);
    animator.setDuration(durtion);
    animator.start();//from   w  w w . ja  va 2 s .  c  o  m
}

From source file:Main.java

public static void rotationAngle(View view, float angleValue, long duration) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotation", 0f, angleValue);
    animator.setDuration(duration);
    animator.start();/*ww w  .ja  v  a2s .c o m*/
}

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

From source file:Main.java

public static ObjectAnimator createShowGradientAnimation(View view) {
    ObjectAnimator alphaAnimation = ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1f);
    alphaAnimation.setDuration(400);
    alphaAnimation.setInterpolator(new LinearInterpolator());
    return alphaAnimation;
}

From source file:Main.java

public static Animator slide(@NonNull View view, int fromY, int toY, int time) {
    ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, "translationY", fromY, toY);
    animatorY.setDuration(time);
    animatorY.start();//from  w  ww . j a v  a2 s  .  c  o m
    return animatorY;
}