com.nineoldandroids.animation.ObjectAnimator.addUpdateListener()方法的使用及代码示例

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

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

ObjectAnimator.addUpdateListener介绍

暂无

代码示例

代码示例来源:origin: chiuki/advanced-textview

@Override
protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_animated_rainbow_span);
 final TextView textView = (TextView) findViewById(R.id.text);
 String text = textView.getText().toString();
 AnimatedColorSpan span = new AnimatedColorSpan(this);
 final SpannableString spannableString = new SpannableString(text);
 String substring = getString(R.string.animated_rainbow_span).toLowerCase();
 int start = text.toLowerCase().indexOf(substring);
 int end = start + substring.length();
 spannableString.setSpan(span, start, end, 0);
 ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(
   span, ANIMATED_COLOR_SPAN_FLOAT_PROPERTY, 0, 100);
 objectAnimator.setEvaluator(new FloatEvaluator());
 objectAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
  @Override
  public void onAnimationUpdate(ValueAnimator animation) {
   textView.setText(spannableString);
  }
 });
 objectAnimator.setInterpolator(new LinearInterpolator());
 objectAnimator.setDuration(DateUtils.MINUTE_IN_MILLIS * 3);
 objectAnimator.setRepeatCount(ValueAnimator.INFINITE);
 objectAnimator.start();
}

代码示例来源:origin: SMSTicket/sms-ticket

animator.setRepeatMode(ValueAnimator.RESTART);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
  final Drawable shape1 = c.getResources().getDrawable(firstImage);
  final Drawable shape2 = c.getResources().getDrawable(secondImage);

代码示例来源:origin: dom4j1/Red

final ObjectAnimator heightAnimation = ObjectAnimator.ofInt(v, "xxx", new int[]{v.getHeight(), v.getWidth() / 2});
heightAnimation.setDuration(duration);
heightAnimation.addUpdateListener(new com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener() {
  @Override
  public void onAnimationUpdate(com.nineoldandroids.animation.ValueAnimator valueAnimator) {
animator.addUpdateListener(new ObjectAnimator.AnimatorUpdateListener() {
  @Override
  public void onAnimationUpdate(com.nineoldandroids.animation.ValueAnimator valueAnimator) {

代码示例来源:origin: agxxxx/AIDLMusicPlayer

private void reverseDiscAnimator() {
  mDiscLayoutAnimator = ObjectAnimator.ofFloat(mDiscLayout, "rotation", mDiscLayoutAnimatorValue, 360);
  mDiscLayoutAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator arg0) {
      mDiscLayoutAnimatorValue = (Float) arg0.getAnimatedValue();
    }
  });
  mDiscLayoutAnimator.setDuration(DISC_REVERSE_ANIMATOR_TIME);
  mDiscLayoutAnimator.setInterpolator(new AccelerateInterpolator());
  if (mDiscLayoutAnimator.isRunning() || mDiscLayoutAnimator.isStarted()) {
    mDiscLayoutAnimator.cancel();
  }
  mDiscLayoutAnimator.start();
}

代码示例来源:origin: agxxxx/AIDLMusicPlayer

private void startDiscAnimator(float animatedValue) {
  mDiscLayoutAnimator = ObjectAnimator.ofFloat(mDiscLayout, "rotation", animatedValue, 360 + animatedValue);
  mDiscLayoutAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator arg0) {
      mDiscLayoutAnimatorValue = (Float) arg0.getAnimatedValue();
    }
  });
  mDiscLayoutAnimator.setDuration(DISC_ANIMATOR_TIME);
  mDiscLayoutAnimator.setRepeatCount(DISC_ANIMATOR_REPEAT_COUNT);
  mDiscLayoutAnimator.setInterpolator(new LinearInterpolator());
  if (mDiscLayoutAnimator.isRunning() || mDiscLayoutAnimator.isStarted()) {
    mDiscLayoutAnimator.cancel();
  }
  mDiscLayoutAnimator.start();
}

代码示例来源:origin: chiemy/LoadingImageView

private void initAnim() {
  stopAnim();
  //animator = ObjectAnimator.ofInt(this, "maskHeight", 0, imageHeight);
  animator = ObjectAnimator.ofInt(clipDrawable, "level", 0, 10000);
  animator.setDuration(animDuration);
  animator.setRepeatCount(ValueAnimator.INFINITE);
  animator.setRepeatMode(ValueAnimator.RESTART);
  animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator animation) {
      invalidate();
    }
  });
  if(autoStart){
    animator.start();
  }
}

代码示例来源:origin: henrichg/PhoneProfilesPlus

public ObjectAnimator getDisappearAnimator() {
  if (!mIsInitialized || !mDrawValuesReady) {
    Log.e(TAG, "RadialSelectorView was not ready for animation.");
    return null;
  }
  Keyframe kf0, kf1, kf2;
  float midwayPoint = 0.2f;
  int duration = 500;
  kf0 = Keyframe.ofFloat(0f, 1);
  kf1 = Keyframe.ofFloat(midwayPoint, mTransitionMidRadiusMultiplier);
  kf2 = Keyframe.ofFloat(1f, mTransitionEndRadiusMultiplier);
  PropertyValuesHolder radiusDisappear = PropertyValuesHolder.ofKeyframe(
      "animationRadiusMultiplier", kf0, kf1, kf2);
  kf0 = Keyframe.ofFloat(0f, 1f);
  kf1 = Keyframe.ofFloat(1f, 0f);
  PropertyValuesHolder fadeOut = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1);
  ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
      AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : this, radiusDisappear, fadeOut).setDuration(
      duration);
  disappearAnimator.addUpdateListener(mInvalidateUpdateListener);
  return disappearAnimator;
}

代码示例来源:origin: henrichg/PhoneProfilesPlus

AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : this, radiusReappear, fadeIn)
    .setDuration(totalDuration);
reappearAnimator.addUpdateListener(mInvalidateUpdateListener);
return reappearAnimator;

代码示例来源:origin: henrichg/PhoneProfilesPlus

AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : this, radiusDisappear, fadeOut)
    .setDuration(duration);
mDisappearAnimator.addUpdateListener(mInvalidateUpdateListener);
    AnimatorProxy.NEEDS_PROXY ? AnimatorProxy.wrap(this) : this, radiusReappear, fadeIn)
    .setDuration(totalDuration);
mReappearAnimator.addUpdateListener(mInvalidateUpdateListener);

相关文章