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> xProperty, Property<T, Float> yProperty,
        Path path) 

Source Link

Document

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties.

Usage

From source file:Main.java

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

From source file:Main.java

public static void slideFromLeftToRight(View view) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "X", -2000, 0).setDuration(1000);

    animator.setInterpolator(new LinearInterpolator());

    animator.start();/*from www .  j a  v a 2  s  . co m*/
}

From source file:Main.java

public static void arrowUpAnim(View view) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotation", 0f, 180f);
    animator.setDuration(400);//w w  w  . j  a v  a2  s . c  om
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.start();
}

From source file:Main.java

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

From source file:Main.java

public static void startAnim(View view) {
    view.clearAnimation();/*  ww w. j  av a  2s .co  m*/
    ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0.2f, 1f);
    scaleY.setDuration(300);
    scaleY.start();
}

From source file:Main.java

public static Animator doMoveVertical(View view, int startY, int endY, int duration) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", startY, endY).setDuration(duration);
    animator.start();/*from www. jav a 2s  .  c om*/
    return animator;
}

From source file:Main.java

public static ObjectAnimator createShowGradientAnimation(View view) {
    ObjectAnimator alphaAnimation = ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1f);
    alphaAnimation.setDuration(400);//from  w  w w. j a v  a 2s.co  m
    alphaAnimation.setInterpolator(new LinearInterpolator());
    return alphaAnimation;
}

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);/*  ww  w .  j  a va2s .com*/
    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);//from  ww w. ja v a 2s . c o  m
    if (delay > 0)
        animator.setStartDelay(delay);

    // go for it
    animator.start();

    return animator;
}

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);//w ww  . j av a  2  s . c  om
    animator.start();
}