Example usage for android.animation ObjectAnimator setRepeatCount

List of usage examples for android.animation ObjectAnimator setRepeatCount

Introduction

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

Prototype

public void setRepeatCount(int value) 

Source Link

Document

Sets how many times the animation should be repeated.

Usage

From source file:Main.java

public static void animation3(View view) {
    ObjectAnimator animator = new ObjectAnimator().ofFloat(view, "rotationY", 0.0f, 360f);
    animator.setDuration(4000);//  w ww. ja  v a  2  s.  co  m
    animator.setRepeatCount(2);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.start();
}

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);/*ww  w.java 2 s . co m*/
    animator.setRepeatCount(-1);
    animator.start();
    return animator;
}

From source file:Main.java

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

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  .  j a  v  a2s  .  c o  m*/
    animator.start();
}

From source file:Main.java

public static void doSimpleRefresh(Object view) {
    LinearInterpolator interpolator = new LinearInterpolator();
    ObjectAnimator refreshAnimator = ObjectAnimator.ofFloat(view, "rotation", 0f, 360f);
    refreshAnimator.setInterpolator(interpolator);
    refreshAnimator.setDuration(300);//from  www .  j  a  va  2  s .  c  om
    refreshAnimator.setRepeatCount(3);
    refreshAnimator.start();
}

From source file:Main.java

public static void doSimpleRefresh(Object view, int repeat) {
    LinearInterpolator interpolator = new LinearInterpolator();
    ObjectAnimator refreshAnimator = ObjectAnimator.ofFloat(view, "rotation", 0f, 360f);
    refreshAnimator.setInterpolator(interpolator);
    refreshAnimator.setDuration(300);//from   w w w. jav  a  2  s .c  o m
    refreshAnimator.setRepeatCount(repeat);
    refreshAnimator.start();
}

From source file:Main.java

public static void breath(View v, float fromRange, float toRange, long duration) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.ALPHA, fromRange, toRange);
    animator.setDuration(duration);/*from w w w .  j  a v a 2  s . co m*/
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.start();
}

From source file:Main.java

public static void animFlicker(View view, long duration, int repeatCount) {
    AnimatorSet animatorSet = new AnimatorSet();
    ObjectAnimator alphaIn = ObjectAnimator.ofFloat(view, "alpha", 0.0f, 1.0f);
    ObjectAnimator alphaOut = ObjectAnimator.ofFloat(view, "alpha", 1.0f, 0.0f);

    alphaIn.setDuration(duration);/* w  ww  .  j av a2  s.c  o  m*/
    alphaIn.setStartDelay(duration);
    alphaOut.setDuration(duration);

    alphaOut.setRepeatCount(repeatCount);
    alphaIn.setRepeatCount(repeatCount);

    animatorSet.playTogether(alphaOut, alphaIn);
    animatorSet.start();
}

From source file:Main.java

public static void shake(View v) {
    final float distance = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4.0f,
            v.getResources().getDisplayMetrics());
    final ObjectAnimator animator = ObjectAnimator.ofFloat(v, "translationX", 0, distance, 0, -distance, 0);
    animator.setRepeatMode(ObjectAnimator.RESTART);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(4);
    animator.setDuration(150);//from   w w  w  .  j  a va  2 s.  c  o m
    animator.start();
}

From source file:com.gigigo.vuforiaimplementation.VuforiaActivity.java

private void startBoringAnimation() {
    scanLine.setVisibility(View.VISIBLE);
    // Create animators for y axe
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        int yMax = 0;
        yMax = getResources().getDisplayMetrics().heightPixels; //mVuforiaView.getDisplay().getHeight();
        yMax = (int) (yMax * 0.9);// 174;

        ObjectAnimator oay = ObjectAnimator.ofFloat(scanLine, "translationY", 0, yMax);
        oay.setRepeatCount(Animation.INFINITE);
        oay.setDuration(ANIM_DURATION);/*from w  ww .  j a va2 s .  co  m*/
        oay.setRepeatMode(Animation.REVERSE);

        oay.setInterpolator(new LinearInterpolator());
        oay.start();

        //for draw points near scanline
        markFakeFeaturePoint.setObjectAnimator(oay);
    }

    //scanAnimation.

}