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 rolloverY(View v) {
    ObjectAnimator yRollover = ObjectAnimator.ofFloat(v, "rotationY", 0f, 3600f);
    AnimatorSet set = new AnimatorSet();
    set.play(yRollover);//  w  ww  . j  ava  2 s .c  om
    yRollover.start();
}

From source file:Main.java

public static ObjectAnimator createScaleYAnimator(View view, float from, float to) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.SCALE_Y, from, to);
    return animator;
}

From source file:Main.java

public static ObjectAnimator createTranslationYAnimator(View view, float from, float to) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, from, to);
    return animator;
}

From source file:Main.java

public static ObjectAnimator createTranslationXAnimator(View view, float from, float to) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.TRANSLATION_X, from, to);
    return animator;
}

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);//www  . ja  va  2 s .c  om
    animator.start();
}

From source file:Main.java

public static void makeSnake(View v) {
    ObjectAnimator snake = ObjectAnimator.ofFloat(v, "translationX", 0, 10).setDuration(300);
    snake.setInterpolator(new CycleInterpolator(2));
    snake.start();/*w w w.j a v a2s . com*/
}

From source file:Main.java

public static void slowViewAnimation(View view) {
    ObjectAnimator translationY = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, -200f, 0f);
    translationY.setDuration(5000);/*from  www  .ja  va 2  s .c  o  m*/
    AnimatorSet translateSlowly = new AnimatorSet();
    translateSlowly.playTogether(translationY);
    translateSlowly.start();
}

From source file:Main.java

public static ObjectAnimator createAlphaAnimator(View targetView, float fromAlpha, float endAlpha) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(targetView, "alpha", fromAlpha, endAlpha);
    return animator;
}

From source file:Main.java

public static void rotateWithDuration(View view, int milliseconds, int radiusFrom, int radiusTo) {
    ObjectAnimator animation = ObjectAnimator.ofFloat(view, "rotation", radiusFrom, radiusTo);
    animation.setDuration(milliseconds);
    animation.start();//w w w .  jav  a 2  s .  c o m
}

From source file:Main.java

public static ObjectAnimator rotate(View view, float startDegree, float endDegree, int duration) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotation", startDegree, endDegree);
    animator.setDuration(duration);//from   w  w w.  ja v a 2 s . c om
    animator.setRepeatCount(-1);
    animator.start();
    return animator;
}