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

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

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

ObjectAnimator.getAnimatedFraction介绍

暂无

代码示例

代码示例来源:origin: googlesamples/android-unsplash

@Override
public void onAnimationPause(Animator animation) {
  textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, drawable.getFontSize());
  final int paddingLeft = Math.round(drawable.getLeft());
  final int paddingTop = Math.round(drawable.getTop());
  final float fraction = animator.getAnimatedFraction();
  final int paddingRight = Math.round(interpolate(startData.paddingRight,
      endData.paddingRight, fraction));
  final int paddingBottom = Math.round(interpolate(startData.paddingBottom,
      endData.paddingBottom, fraction));
  textView.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
  textView.setTextColor(drawable.getTextColor());
}

代码示例来源:origin: DroidsOnRoids/Workcation

@Override
public void onAnimationPause(Animator animation) {
  textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, drawable.getFontSize());
  final int paddingLeft = Math.round(drawable.getLeft());
  final int paddingTop = Math.round(drawable.getTop());
  final float fraction = animator.getAnimatedFraction();
  final int paddingRight = Math.round(interpolate(startData.paddingRight,
      endData.paddingRight, fraction));
  final int paddingBottom = Math.round(interpolate(startData.paddingBottom,
      endData.paddingBottom, fraction));
  textView.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
  textView.setTextColor(drawable.getTextColor());
}

代码示例来源:origin: mabeijianxi/ViewLargerImageUtil

float percent = 0;
if (mAnimator != null) {
  percent = mAnimator.getAnimatedFraction();

代码示例来源:origin: crvv/android_wubi_input

private static void cancelAndStartAnimators(final ObjectAnimator animatorToCancel,
    final ObjectAnimator animatorToStart) {
  if (animatorToCancel == null || animatorToStart == null) {
    // TODO: Stop using null as a no-operation animator.
    return;
  }
  float startFraction = 0.0f;
  if (animatorToCancel.isStarted()) {
    animatorToCancel.cancel();
    startFraction = 1.0f - animatorToCancel.getAnimatedFraction();
  }
  final long startTime = (long)(animatorToStart.getDuration() * startFraction);
  animatorToStart.start();
  animatorToStart.setCurrentPlayTime(startTime);
}

代码示例来源:origin: rkkr/simple-keyboard

private static void cancelAndStartAnimators(final ObjectAnimator animatorToCancel,
    final ObjectAnimator animatorToStart) {
  if (animatorToCancel == null || animatorToStart == null) {
    // TODO: Stop using null as a no-operation animator.
    return;
  }
  float startFraction = 0.0f;
  if (animatorToCancel.isStarted()) {
    animatorToCancel.cancel();
    startFraction = 1.0f - animatorToCancel.getAnimatedFraction();
  }
  final long startTime = (long)(animatorToStart.getDuration() * startFraction);
  animatorToStart.start();
  animatorToStart.setCurrentPlayTime(startTime);
}

代码示例来源:origin: luhaoaimama1/zone-sdk

@TargetApi(Build.VERSION_CODES.KITKAT)
  private void information() {
    log("information:--->getCurrentPlayTime:" + objAni.getCurrentPlayTime()
        + "\t getAnimatedValue:" + objAni.getAnimatedValue()
        + "\t getAnimatedFraction:" + objAni.getAnimatedFraction()
        + "\t isPaused:" + objAni.isPaused()
        + "\t isStart:" + objAni.isStarted()
        + "\t isRunning:" + objAni.isRunning()
    );
  }
}

代码示例来源:origin: google-ar/sceneform-android-sdk

@Override
public void onUpdate(FrameTime frameTime) {
 super.onUpdate(frameTime);
 // Animation hasn't been set up.
 if (orbitAnimation == null) {
  return;
 }
 // Check if we need to change the speed of rotation.
 float speedMultiplier = getSpeedMultiplier();
 // Nothing has changed. Continue rotating at the same speed.
 if (lastSpeedMultiplier == speedMultiplier) {
  return;
 }
 if (speedMultiplier == 0.0f) {
  orbitAnimation.pause();
 } else {
  orbitAnimation.resume();
  float animatedFraction = orbitAnimation.getAnimatedFraction();
  orbitAnimation.setDuration(getAnimationDuration());
  orbitAnimation.setCurrentFraction(animatedFraction);
 }
 lastSpeedMultiplier = speedMultiplier;
}

相关文章