Example usage for android.animation ObjectAnimator ofFloat

List of usage examples for android.animation ObjectAnimator ofFloat

Introduction

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

Prototype

public static <T> ObjectAnimator ofFloat(T target, Property<T, Float> property, float... values) 

Source Link

Document

Constructs and returns an ObjectAnimator that animates between float values.

Usage

From source file:Main.java

public static void rotate(View view, float... a) {
    ObjectAnimator.ofFloat(view, "rotation", a).setDuration(3000).start();
}

From source file:Main.java

public static void fadeOut(View view, int duration) {
    ObjectAnimator.ofFloat(view, "alpha", 0).setDuration(duration).start();
}

From source file:Main.java

public static void moveTop(Object v, int end) {
    y -= end;/*from  w w w.  j a va  2s  . c o  m*/
    ObjectAnimator.ofFloat(v, "translationY", y).setDuration(duration).start();
}

From source file:Main.java

public static void rotate(Object v, float end) {
    r += end;/*w w w  .ja v a2  s.  c  o  m*/
    ObjectAnimator.ofFloat(v, "rotation", r).setDuration(duration).start();
}

From source file:Main.java

public static void moveDown(Object v, int end) {
    y += end;//from w  ww  .j a va 2 s.com
    ObjectAnimator.ofFloat(v, "translationY", y).setDuration(duration).start();
}

From source file:Main.java

public static void moveLeft(Object v, float end) {
    x -= end;//from  w  w  w  .  j  a  va 2 s. c o m
    ObjectAnimator.ofFloat(v, "translationX", x).setDuration(duration).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  w  w  . j a  va  2s.  com
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.start();
}

From source file:Main.java

public static Animator animFade(View view, float f1, float f2) {
    return ObjectAnimator.ofFloat(view, "alpha", new float[] { f1, f2 });
}

From source file:Main.java

public static Animator animScaleX(View view, float f1, float f2) {
    return ObjectAnimator.ofFloat(view, "scaleX", new float[] { f1, f2 });
}

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. ja va2 s  .c o  m*/
    return objectAnimator;
}