android.animation.ObjectAnimator.setRepeatCount()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中android.animation.ObjectAnimator.setRepeatCount()方法的一些代码示例,展示了ObjectAnimator.setRepeatCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectAnimator.setRepeatCount()方法的具体详情如下:
包路径:android.animation.ObjectAnimator
类名称:ObjectAnimator
方法名:setRepeatCount

ObjectAnimator.setRepeatCount介绍

暂无

代码示例

代码示例来源:origin: aa112901/remusic

public void initRotateAnimation(float start) {
  mObjectAnimator = ObjectAnimator.ofFloat(this, "rotation", start, 360f + start);
  mObjectAnimator.setDuration(DEFAULT_DURATION);
  mObjectAnimator.setInterpolator(new LinearInterpolator());
  mObjectAnimator.setRepeatCount(ObjectAnimator.INFINITE);
}

代码示例来源:origin: seven332/EhViewer

private void setupAnimators() {
  ObjectAnimator trimStart = ObjectAnimator.ofFloat(this, "trimStart", 0.0f, 0.75f);
  trimStart.setDuration(1333L);
  trimStart.setInterpolator(TRIM_START_INTERPOLATOR);
  trimStart.setRepeatCount(Animation.INFINITE);
  ObjectAnimator trimEnd = ObjectAnimator.ofFloat(this, "trimEnd", 0.0f, 0.75f);
  trimEnd.setDuration(1333L);
  trimEnd.setInterpolator(TRIM_END_INTERPOLATOR);
  trimEnd.setRepeatCount(Animation.INFINITE);
  ObjectAnimator trimOffset = ObjectAnimator.ofFloat(this, "trimOffset", 0.0f, 0.25f);
  trimOffset.setDuration(1333L);
  trimOffset.setInterpolator(LINEAR_INTERPOLATOR);
  trimOffset.setRepeatCount(Animation.INFINITE);
  ObjectAnimator trimRotation = ObjectAnimator.ofFloat(this, "trimRotation", 0.0f, 720.0f);
  trimRotation.setDuration(6665L);
  trimRotation.setInterpolator(LINEAR_INTERPOLATOR);
  trimRotation.setRepeatCount(Animation.INFINITE);
  mAnimators.add(trimStart);
  mAnimators.add(trimEnd);
  mAnimators.add(trimOffset);
  mAnimators.add(trimRotation);
}

代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar

/**
   * Create a backported Animator for
   * {@code @android:anim/progress_indeterminate_rotation_material}.
   *
   * @param target The object whose properties are to be animated.
   * @return An Animator object that is set up to behave the same as the its native counterpart.
   */
  @NonNull
  public static Animator createIndeterminateRotation(@NonNull Object target) {
    @SuppressLint("ObjectAnimatorBinding")
    ObjectAnimator rotationAnimator = ObjectAnimator.ofFloat(target, "rotation", 0, 720);
    rotationAnimator.setDuration(6665);
    rotationAnimator.setInterpolator(Interpolators.LINEAR.INSTANCE);
    rotationAnimator.setRepeatCount(ValueAnimator.INFINITE);
    return rotationAnimator;
  }
}

代码示例来源:origin: android-cjj/Android-MaterialRefreshLayout

/**
 * 开启转圈圈
 *
 * @param v
 */
public void startSunLineAnim(View v) {
  if (mAnimator == null) {
    mAnimator = ObjectAnimator.ofFloat(v, "rotation", 0f, 720f);
    mAnimator.setDuration(7 * 1000);
    mAnimator.setInterpolator(new LinearInterpolator());
    mAnimator.setRepeatCount(ValueAnimator.INFINITE);
  }
  if (!mAnimator.isRunning())
    mAnimator.start();
}

代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar

trimPathStartAnimator.setDuration(1333);
trimPathStartAnimator.setInterpolator(Interpolators.TRIM_PATH_START.INSTANCE);
trimPathStartAnimator.setRepeatCount(ValueAnimator.INFINITE);
trimPathEndAnimator.setDuration(1333);
trimPathEndAnimator.setInterpolator(Interpolators.TRIM_PATH_END.INSTANCE);
trimPathEndAnimator.setRepeatCount(ValueAnimator.INFINITE);
trimPathOffsetAnimator.setDuration(1333);
trimPathOffsetAnimator.setInterpolator(Interpolators.LINEAR.INSTANCE);
trimPathOffsetAnimator.setRepeatCount(ValueAnimator.INFINITE);

代码示例来源:origin: aa112901/remusic

@Override
  public void onStart() {
    super.onStart();
//        animatorWeakReference = new  WeakReference<ObjectAnimator>(new ObjectAnimator());
//        animator = animatorWeakReference.get();
    animatorWeakReference = new WeakReference(ObjectAnimator.ofFloat(getView(), "rotation", new float[]{0.0F, 360.0F}));
    animator = animatorWeakReference.get();
    //animator = ObjectAnimator.ofFloat(getView(), "rotation", new float[]{0.0F, 360.0F});
    animator.setRepeatCount(Integer.MAX_VALUE);
    animator.setDuration(25000L);
    animator.setInterpolator(new LinearInterpolator());

    if (getView() != null)
      getView().setTag(R.id.tag_animator, this.animator);
  }

代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar

/**
 * Create a backported Animator for
 * {@code @android:anim/progress_indeterminate_horizontal_rect1}.
 *
 * @param target The object whose properties are to be animated.
 * @return An Animator object that is set up to behave the same as the its native counterpart.
 */
@NonNull
public static Animator createIndeterminateHorizontalRect1(@NonNull Object target) {
  ObjectAnimator translateXAnimator = ObjectAnimatorCompat.ofFloat(target, "translateX", null,
      PATH_INDETERMINATE_HORIZONTAL_RECT1_TRANSLATE_X);
  translateXAnimator.setDuration(2000);
  translateXAnimator.setInterpolator(
      Interpolators.INDETERMINATE_HORIZONTAL_RECT1_TRANSLATE_X.INSTANCE);
  translateXAnimator.setRepeatCount(ValueAnimator.INFINITE);
  ObjectAnimator scaleXAnimator = ObjectAnimatorCompat.ofFloat(target, null, "scaleX",
      PATH_INDETERMINATE_HORIZONTAL_RECT1_SCALE_X);
  scaleXAnimator.setDuration(2000);
  scaleXAnimator.setInterpolator(
      Interpolators.INDETERMINATE_HORIZONTAL_RECT1_SCALE_X.INSTANCE);
  scaleXAnimator.setRepeatCount(ValueAnimator.INFINITE);
  AnimatorSet animatorSet = new AnimatorSet();
  animatorSet.playTogether(translateXAnimator, scaleXAnimator);
  return animatorSet;
}

代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar

/**
 * Create a backported Animator for
 * {@code @android:anim/progress_indeterminate_horizontal_rect2}.
 *
 * @param target The object whose properties are to be animated.
 * @return An Animator object that is set up to behave the same as the its native counterpart.
 */
@NonNull
public static Animator createIndeterminateHorizontalRect2(@NonNull Object target) {
  ObjectAnimator translateXAnimator = ObjectAnimatorCompat.ofFloat(target, "translateX", null,
      PATH_INDETERMINATE_HORIZONTAL_RECT2_TRANSLATE_X);
  translateXAnimator.setDuration(2000);
  translateXAnimator.setInterpolator(
      Interpolators.INDETERMINATE_HORIZONTAL_RECT2_TRANSLATE_X.INSTANCE);
  translateXAnimator.setRepeatCount(ValueAnimator.INFINITE);
  ObjectAnimator scaleXAnimator = ObjectAnimatorCompat.ofFloat(target, null, "scaleX",
      PATH_INDETERMINATE_HORIZONTAL_RECT2_SCALE_X);
  scaleXAnimator.setDuration(2000);
  scaleXAnimator.setInterpolator(
      Interpolators.INDETERMINATE_HORIZONTAL_RECT2_SCALE_X.INSTANCE);
  scaleXAnimator.setRepeatCount(ValueAnimator.INFINITE);
  AnimatorSet animatorSet = new AnimatorSet();
  animatorSet.playTogether(translateXAnimator, scaleXAnimator);
  return animatorSet;
}

代码示例来源:origin: ybq/Android-SpinKit

holders);
animator.setDuration(duration);
animator.setRepeatCount(repeatCount);
animator.setInterpolator(interpolator);
return animator;

代码示例来源:origin: aa112901/remusic

anim = ObjectAnimator.ofFloat(sectionImg, "rotation", 90, 0);
anim.setDuration(100);
anim.setRepeatCount(0);
anim.setInterpolator(new LinearInterpolator());
switch (getItemViewType()) {

代码示例来源:origin: jaydenxiao2016/AndroidFire

objectAnimator1.setRepeatCount(ValueAnimator.INFINITE);
objectAnimator1.setRepeatMode(ValueAnimator.INFINITE);
objectAnimator2.setRepeatCount(ValueAnimator.INFINITE);
objectAnimator2.setRepeatMode(ValueAnimator.INFINITE);
objectAnimator3.setRepeatCount(ValueAnimator.INFINITE);
objectAnimator3.setRepeatMode(ValueAnimator.INFINITE);

代码示例来源:origin: stackoverflow.com

mMyImageView.setImageDrawable(myDrawable);

ObjectAnimator anim = ObjectAnimator.ofInt(myDrawable, "level", 0, MAX_LEVEL);
anim.setRepeatCount(ObjectAnimator.INFINITE);
anim.start();

代码示例来源:origin: stackoverflow.com

ObjectAnimator anim = ObjectAnimator.ofInt(myImageVew, "ImageLevel", 0, MAX_LEVEL);
anim.setRepeatCount(ObjectAnimator.INFINITE);
anim.start();

代码示例来源:origin: curtis2/SuperVideoPlayer

@NonNull
private void startLoadingAnimator() {
  if(mOjectAnimator==null){
    mOjectAnimator = ObjectAnimator.ofFloat(mLoadingImg, "rotation", 0f, 360f);
  }
  mLoadingLayout.setVisibility(View.VISIBLE);
  mOjectAnimator.setDuration(1000);
  mOjectAnimator.setRepeatCount(-1);
  mOjectAnimator.start();
}

代码示例来源:origin: curtis2/SuperVideoPlayer

@NonNull
private void startLoadingAnimator() {
  if(mOjectAnimator==null){
    mOjectAnimator = ObjectAnimator.ofFloat(mLoadingImg, "rotation", 0f, 360f);
  }
  mLoadingLayout.setVisibility(View.VISIBLE);
  mOjectAnimator.setDuration(1000);
  mOjectAnimator.setRepeatCount(-1);
  mOjectAnimator.start();
}

代码示例来源:origin: stackoverflow.com

ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(ImageView,
         PropertyValuesHolder.ofFloat("scaleX", 1.2f),
         PropertyValuesHolder.ofFloat("scaleY", 1.2f));
     scaleDown.setDuration(310);
     scaleDown.setRepeatCount(ObjectAnimator.INFINITE);
     scaleDown.setRepeatMode(ObjectAnimator.REVERSE);
     scaleDown.start();

代码示例来源:origin: stackoverflow.com

ObjectAnimator animY = ObjectAnimator.ofFloat(button, "translationY", -100f, 0f);
animY.setDuration(1000);//1sec
animY.setInterpolator(new BounceInterpolator());
animY.setRepeatCount(numRepeats);
animY.start();

代码示例来源:origin: mayubao/KuaiChuan

private ObjectAnimator create(View target, String propertyName, int repeatCount, long delay, float from, float to) {
  ObjectAnimator animator = ObjectAnimator.ofFloat(target, propertyName, from, to);
  animator.setRepeatCount(repeatCount);
  animator.setRepeatMode(ObjectAnimator.RESTART);
  animator.setStartDelay(delay);
  return animator;
}

代码示例来源:origin: glomadrian/RoadRunner

@OnClick(R.id.runButton)
public void runButtonClick() {
  if (infiniteAnimator == null) {
    infiniteAnimator = ObjectAnimator.ofInt(roadRunner, ProgressRoadRunner.PROGRESS, 100);
    infiniteAnimator.setDuration(1000);
    infiniteAnimator.setRepeatMode(ObjectAnimator.RESTART);
    infiniteAnimator.setRepeatCount(ObjectAnimator.INFINITE);
    infiniteAnimator.setInterpolator(new FastOutSlowInInterpolator());
  }
  infiniteAnimator.start();
}

代码示例来源:origin: stackoverflow.com

ObjectAnimator colorAnim = ObjectAnimator.ofInt(myButton, "textColor", Color.RED, Color.TRANSPARENT); 
colorAnim.setDuration(1000); 
colorAnim.setEvaluator(new ArgbEvaluator());     
colorAnim.setRepeatCount(ValueAnimator.INFINITE); 
colorAnim.setRepeatMode(ValueAnimator.REVERSE); 
colorAnim.start();

相关文章