Java Code Examples for com.nineoldandroids.animation.ValueAnimator#setRepeatCount()
The following examples show how to use
com.nineoldandroids.animation.ValueAnimator#setRepeatCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BallPulseIndicator.java From AndroidPlayground with MIT License | 6 votes |
@Override public List<Animator> createAnimation() { List<Animator> animators = new ArrayList<>(); for (int i = 0; i < CIRCLE_NUM; i++) { final int index = i; ValueAnimator scaleAnim = ValueAnimator.ofFloat(1, 0.3f, 1); scaleAnim.setDuration(BASE_DELAY_MILLIS * CIRCLE_NUM * 3 / 2); scaleAnim.setRepeatCount(-1); scaleAnim.setStartDelay(delays[i]); scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { scaleFloats[index] = (float) animation.getAnimatedValue(); postInvalidate(); } }); scaleAnim.start(); animators.add(scaleAnim); } return animators; }
Example 2
Source File: PathAnimatorInflater.java From CanDialog with Apache License 2.0 | 5 votes |
/** * @param anim The animator, must not be null * @param arrayAnimator Incoming typed array for Animator's attributes. * @param arrayObjectAnimator Incoming typed array for Object Animator's * attributes. */ private static void parseAnimatorFromTypeArray(ValueAnimator anim, TypedArray arrayAnimator, TypedArray arrayObjectAnimator) { long duration = arrayAnimator.getInt(R.styleable.Animator_android_duration, 300); long startDelay = arrayAnimator.getInt(R.styleable.Animator_android_startOffset, 0); int valueType = arrayAnimator.getInt(R.styleable.Animator_vc_valueType, 0); TypeEvaluator evaluator = null; // Must be a path animator by the time I reach here if (valueType == VALUE_TYPE_PATH) { evaluator = setupAnimatorForPath(anim, arrayAnimator); } else { throw new IllegalArgumentException("target is not a pathType target"); } anim.setDuration(duration); anim.setStartDelay(startDelay); if (arrayAnimator.hasValue(R.styleable.Animator_android_repeatCount)) { anim.setRepeatCount( arrayAnimator.getInt(R.styleable.Animator_android_repeatCount, 0)); } if (arrayAnimator.hasValue(R.styleable.Animator_android_repeatMode)) { anim.setRepeatMode( arrayAnimator.getInt(R.styleable.Animator_android_repeatMode, ValueAnimator.RESTART)); } if (evaluator != null) { anim.setEvaluator(evaluator); } if (arrayObjectAnimator != null) { setupObjectAnimator(anim, arrayObjectAnimator); } }
Example 3
Source File: AnimatedDrawable.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
@Override public ValueAnimator createValueAnimator(int maxDurationMs) { ValueAnimator animator = createValueAnimator(); int repeatCount = Math.max((maxDurationMs / mAnimatedDrawableBackend.getDurationMs()), 1); animator.setRepeatCount(repeatCount); return animator; }
Example 4
Source File: AnimatedDrawable.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
@Override public ValueAnimator createValueAnimator() { int loopCount = mAnimatedDrawableBackend.getLoopCount(); ValueAnimator animator = new ValueAnimator(); animator.setIntValues(0, mDurationMs); animator.setDuration(mDurationMs); animator.setRepeatCount(loopCount != 0 ? loopCount : ValueAnimator.INFINITE); animator.setRepeatMode(ValueAnimator.RESTART); animator.setInterpolator(new LinearInterpolator()); animator.addUpdateListener(createAnimatorUpdateListener()); return animator; }