Example usage for android.animation ObjectAnimator reverse

List of usage examples for android.animation ObjectAnimator reverse

Introduction

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

Prototype

@Override
public void reverse() 

Source Link

Document

Plays the ValueAnimator in reverse.

Usage

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);//from w  w w .ja  v a 2 s .  c  om
    animator.start();
}

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  w w.  j  a  v a  2 s  . com
    animator.start();
}

From source file:com.google.cloud.android.dialogflow.ui.AudioIndicatorView.java

private void startAnimating() {
    mAnimator = ObjectAnimator.ofFloat(this, View.ALPHA, 1.f, 0.3f);
    mAnimator.setRepeatCount(ObjectAnimator.INFINITE);
    mAnimator.setRepeatMode(ObjectAnimator.REVERSE);
    mAnimator.setDuration(1000);//from w  w  w .  j a  v a  2 s.c o  m
    mAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    mAnimator.start();
}

From source file:io.vit.vitio.Fragments.Today.TodayFragment.java

private void animateView() {
    PowerManager powerManager = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && powerManager.isPowerSaveMode()) {
        return;/*from  ww  w  .  j  a  v  a2  s  . c om*/
    }
    //float dimension = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 200, getResources().getDisplayMetrics());
    ObjectAnimator objectAnimatorX = ObjectAnimator.ofFloat(ocassionImage, "scaleX", 1f, 0.8f);
    ObjectAnimator objectAnimatorY = ObjectAnimator.ofFloat(ocassionImage, "scaleY", 1f, 0.8f);
    objectAnimatorX.setDuration(6000);
    objectAnimatorY.setDuration(6000);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(objectAnimatorX, objectAnimatorY);
    animatorSet.setInterpolator(new LinearInterpolator());
    objectAnimatorX.setRepeatCount(ObjectAnimator.INFINITE);
    objectAnimatorX.setRepeatMode(ObjectAnimator.REVERSE);
    objectAnimatorY.setRepeatCount(ObjectAnimator.INFINITE);
    objectAnimatorY.setRepeatMode(ObjectAnimator.REVERSE);
    animatorSet.start();
    objectAnimatorX.start();
}