android.animation.AnimatorSet.getChildAnimations()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(79)

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

AnimatorSet.getChildAnimations介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public AnimatorSetAssert hasAnimatorCount(int count) {
  isNotNull();
  int actualCount = actual.getChildAnimations().size();
  assertThat(actualCount) //
    .overridingErrorMessage("Expected animator count <%s> but was <%s>.", count, actualCount) //
    .isEqualTo(count);
  return myself;
 }
}

代码示例来源:origin: florent37/ExpectAnim

public void setPercent(float percent) {
  calculate();
  if (animatorSet != null) {
    final ArrayList<Animator> anims = animatorSet.getChildAnimations();
    for (Animator animator : anims) {
      if (animator instanceof ValueAnimator) {
        ((ValueAnimator) animator).setCurrentPlayTime((long) (percent * animator.getDuration()));
      }
    }
  }
}

代码示例来源:origin: wajahatkarim3/EasyFlipView

/**
 * Sets the flip duration (in milliseconds)
 *
 * @param flipDuration duration in milliseconds
 */
public void setFlipDuration(int flipDuration) {
  this.flipDuration = flipDuration;
  if (flipType.equalsIgnoreCase("horizontal")) {
    //mSetRightOut.setDuration(flipDuration);
    mSetRightOut.getChildAnimations().get(0).setDuration(flipDuration);
    mSetRightOut.getChildAnimations().get(1).setStartDelay(flipDuration / 2);
    //mSetLeftIn.setDuration(flipDuration);
    mSetLeftIn.getChildAnimations().get(1).setDuration(flipDuration);
    mSetLeftIn.getChildAnimations().get(2).setStartDelay(flipDuration / 2);
  } else {
    mSetTopOut.getChildAnimations().get(0).setDuration(flipDuration);
    mSetTopOut.getChildAnimations().get(1).setStartDelay(flipDuration / 2);
    mSetBottomIn.getChildAnimations().get(1).setDuration(flipDuration);
    mSetBottomIn.getChildAnimations().get(2).setStartDelay(flipDuration / 2);
  }
}

代码示例来源:origin: OCNYang/Android-Animation-Set

/**
 * use property animation by xml;
 *
 * @return
 */
private Animator getAnimationByXml() {
  final int height = mPuppet.getLayoutParams().height;
  final int width = mPuppet.getLayoutParams().width;
  AnimatorSet animatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(this, R.animator.animatorset);
  //ValueAnimator usage:add AnimatorUpdateListener;
  ArrayList<Animator> childAnimations = animatorSet.getChildAnimations();
  ((ValueAnimator) childAnimations.get(childAnimations.size() - 1))
      .addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
          float animatedValue = (float) valueAnimator.getAnimatedValue();
          mPuppet.getLayoutParams().height = (int) (height * animatedValue);
          mPuppet.getLayoutParams().width = (int) (width * animatedValue);
          mPuppet.requestLayout();
        }
      });
  animatorSet.setTarget(mPuppet);
  return animatorSet;
}

代码示例来源:origin: GcsSloop/diycode

public void setPercent(float percent) {
  calculate();
  if (animatorSet != null) {
    final ArrayList<Animator> anims = animatorSet.getChildAnimations();
    for (Animator animator : anims) {
      if (animator instanceof ValueAnimator) {
        ((ValueAnimator) animator).setCurrentPlayTime((long) (percent * animator.getDuration()));
      }
    }
  }
}

代码示例来源:origin: MoMoWait/LeanbackLauncher

public String toString() {
    StringBuilder buf = new StringBuilder().append(getClass().getSimpleName()).append('@').append(Integer.toHexString(hashCode())).append('{');
    for (Animator animation : ((AnimatorSet) this.mDelegate).getChildAnimations()) {
      buf.append("\n    ").append(animation.toString().replaceAll("\n", "\n    "));
    }
    return buf.append("\n}").toString();
  }
}

代码示例来源:origin: Pgrammerybj/AnimationUtils

private void setAllAnimationsRepeatCount(int repeatCount) {
    for (Animator animator : mAnimatorSet.getChildAnimations()) {
      if (animator instanceof ObjectAnimator) {
        ((ObjectAnimator) animator).setRepeatCount(repeatCount);
      }
    }
  }
}

代码示例来源:origin: rockon999/LeanbackLauncher

public String toString() {
    StringBuilder buf = new StringBuilder().append(getClass().getSimpleName()).append('@').append(Integer.toHexString(hashCode())).append('{');
    Iterator it = ((AnimatorSet) this.mDelegate).getChildAnimations().iterator();
    while (it.hasNext()) {
      buf.append("\n    ").append(((Animator) it.next()).toString().replaceAll("\n", "\n    "));
    }
    return buf.append("\n}").toString();
  }
}

代码示例来源:origin: rockon999/LeanbackLauncher

public void reset() {
  Iterator it = ((AnimatorSet) this.mDelegate).getChildAnimations().iterator();
  while (it.hasNext()) {
    Animator animation = (Animator) it.next();
    if (animation instanceof Resettable) {
      ((Resettable) animation).reset();
    }
  }
}

代码示例来源:origin: rockon999/LeanbackLauncher

public void exclude(View target) {
  Iterator it = ((AnimatorSet) this.mDelegate).getChildAnimations().iterator();
  while (it.hasNext()) {
    Animator animation = (Animator) it.next();
    if (animation instanceof Joinable) {
      ((Joinable) animation).exclude(target);
    }
  }
}

代码示例来源:origin: qiaoyhh/MvpBase

/**
 * For each animation child sets their duration using length/speed operation.
 *
 * @param speed new speed.
 */
public void setSpeed(int speed) {
  mSpeed = speed;
  List<Animator> listAnimator = mAnimatorSet.getChildAnimations();
  for (int i = 0; i < listAnimator.size(); i++) {
    Animator a = listAnimator.get(i);
    a.setDuration(parseSpeed(pathDistances.get(i)));
  }
}

代码示例来源:origin: tajchert/WaitingDots

private void setAllAnimationsRepeatCount(int repeatCount) {
  for (Animator animator : mAnimatorSet.getChildAnimations()) {
    if (animator instanceof ObjectAnimator) {
      ((ObjectAnimator) animator).setRepeatCount(repeatCount);
    }
  }
}

代码示例来源:origin: rockon999/LeanbackLauncher

public void include(View target) {
  Iterator it = ((AnimatorSet) this.mDelegate).getChildAnimations().iterator();
  while (it.hasNext()) {
    Animator animation = (Animator) it.next();
    if (animation instanceof Joinable) {
      ((Joinable) animation).include(target);
    }
  }
}

代码示例来源:origin: MoMoWait/LeanbackLauncher

public void include(View target) {
  for (Animator animation : ((AnimatorSet) this.mDelegate).getChildAnimations()) {
    if (animation instanceof Joinable) {
      ((Joinable) animation).include(target);
    }
  }
}

代码示例来源:origin: MoMoWait/LeanbackLauncher

public void exclude(View target) {
  for (Animator animation : ((AnimatorSet) this.mDelegate).getChildAnimations()) {
    if (animation instanceof Joinable) {
      ((Joinable) animation).exclude(target);
    }
  }
}

代码示例来源:origin: MoMoWait/LeanbackLauncher

public void reset() {
  for (Animator animation : ((AnimatorSet) this.mDelegate).getChildAnimations()) {
    if (animation instanceof Resettable) {
      ((Resettable) animation).reset();
    }
  }
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public AnimatorSetAssert hasAnimatorCount(int count) {
  isNotNull();
  int actualCount = actual.getChildAnimations().size();
  assertThat(actualCount) //
    .overridingErrorMessage("Expected animator count <%s> but was <%s>.", count, actualCount) //
    .isEqualTo(count);
  return myself;
 }
}

代码示例来源:origin: hujiaweibujidao/wava

/**
 * start to animate
 */
public void start() {
  reset();
  prepare();
  if (mRepeat != 0) {
    for (Animator animator : mAnimatorSet.getChildAnimations()) {
      ((ValueAnimator) animator).setRepeatCount(mRepeat > 0 ? mRepeat - 1 : mRepeat);//区别无穷次
      //((ValueAnimator) animator).setRepeatMode(ValueAnimator.REVERSE);
    }
  }
  if (mRest) {
    mAnimatorSet.addListener(new AnimatorListenerAdapter() {
      @Override
      public void onAnimationEnd(Animator animation) {
        reset();
      }
    });
  }
  mAnimatorSet.start();
}

代码示例来源:origin: leveychen/RxBanner

@Override
public WormAnimation progress(float progress) {
  if (animator == null) {
    return this;
  }
  long progressDuration = (long) (progress * animationDuration);
  for (Animator anim : animator.getChildAnimations()) {
    ValueAnimator animator = (ValueAnimator) anim;
    long duration = animator.getDuration();
    long setDuration = progressDuration;
    if (setDuration > duration) {
      setDuration = duration;
    }
    animator.setCurrentPlayTime(setDuration);
    progressDuration -= setDuration;
  }
  return this;
}

代码示例来源:origin: Appolica/Flubber

@Override
public void onFlubberClick(View view) {
  final EditorFragment editorFragment =
      (EditorFragment) getSupportFragmentManager().findFragmentByTag(EditorFragment.TAG);
  if (editorFragment != null && editorFragment.isVisible()) {
    editorFragment.onFlubberClick(view);
  } else {
    final MainPanelFragment fragment = getFragment(MainPanelFragment.TAG);
    AnimatorSet allAnimationsSet = buildSetForBodies(fragment.getAnimations(), view);
    if (allAnimationsSet.getChildAnimations().size() > 0) {
      allAnimationsSet.start();
    }
  }
}

相关文章