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

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

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

ObjectAnimator.setInterpolator介绍

暂无

代码示例

代码示例来源:origin: navasmdc/MaterialDesignLibrary

public void hide(){
  
  ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", hidePosition);
  animator.setInterpolator(new BounceInterpolator());
  animator.setDuration(1500);
  animator.start();
  
  isShow = false;
}

代码示例来源:origin: navasmdc/MaterialDesignLibrary

public void show(){
  ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", showPosition);
  animator.setInterpolator(new BounceInterpolator());
  animator.setDuration(1500);
  animator.start();
  isShow = true;
}

代码示例来源: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: Leaking/WeGit

public void setInterpolator(Interpolator interpolator) {
  transformation.setInterpolator(interpolator);
}

代码示例来源:origin: peng8350/JPTabBar

@Override
public void onSelectChanged(View v,boolean selected) {
  float end = selected?180f:0f;
  ObjectAnimator flipAnimator = ObjectAnimator.ofFloat(v,"rotationY",end);
  flipAnimator.setDuration(400);
  flipAnimator.setInterpolator(new DecelerateInterpolator());
  flipAnimator.start();
}

代码示例来源:origin: canyinghao/CanEffect

public float startAnimator(float centerX, float centerY, String radiusStr) {
  float maxX = Math.max(centerX, getWidth() - centerX);
  float maxY = Math.max(centerY, getHeight() - centerY);
  float max = Math.max(maxX, maxY);
  ObjectAnimator ripple = ObjectAnimator.ofFloat(this, radiusStr, 0, max);
  ripple.setDuration((long) (max + max * 10 * (1 - waterSpeed)));
  ripple.setInterpolator(new DecelerateInterpolator());
  ripple.start();
  return max;
}

代码示例来源:origin: canyinghao/CanEffect

public void startAnimator(float x, float y) {
  float maxX = Math.max(x, getWidth() - x);
  float maxY = Math.max(y, getHeight() - y);
  radiusMax = (float) Math.sqrt(Math.pow(maxX, 2) + Math.pow(maxY, 2));
  ripple = ObjectAnimator.ofFloat(this, "radius", 0, radiusMax);
  ripple.setDuration((long) (radiusMax + radiusMax * 10 * (1 - rippleSpeed)));
  ripple.setInterpolator(new OvershootInterpolator());
  ripple.start();
}

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

@Override
  public void onStateChange(int state) {
    if (state == AnimatedSvgView.STATE_FILL_STARTED) {
      AnimatorSet set = new AnimatorSet();
      Interpolator interpolator = new DecelerateInterpolator();
      ObjectAnimator a1 = ObjectAnimator.ofFloat(mAnimatedSvgView, "translationY", 0);
      a1.setInterpolator(interpolator);
      set.playTogether(a1);
      set.start();
    }
  }
});

代码示例来源:origin: Leaking/WeGit

private void initAnimations(int transformDuration, int pressedDuration) {
  transformation = ObjectAnimator.ofFloat(this, transformationProperty, 0);
  transformation.setInterpolator(new DecelerateInterpolator(3));
  transformation.setDuration(transformDuration);
  transformation.addListener(new AnimatorListenerAdapter() {
    @Override public void onAnimationEnd(Animator animation) {
      transformationRunning = false;
      setIconState(animatingIconState);
    }
  });
  pressedCircle = ObjectAnimator.ofFloat(this, pressedProgressProperty, 0, 0);
  pressedCircle.setDuration(pressedDuration);
  pressedCircle.setInterpolator(new DecelerateInterpolator());
  pressedCircle.addListener(new AnimatorListenerAdapter() {
    @Override public void onAnimationEnd(Animator animation) {
      pressedProgressValue = 0;
    }
    @Override public void onAnimationCancel(Animator animation) {
      pressedProgressValue = 0;
    }
  });
}

代码示例来源:origin: peng8350/JPTabBar

@Override
public void onSelectChanged(View v, boolean selected) {
  int end = selected?-10:0;
  ObjectAnimator jumpAnimator = ObjectAnimator.ofFloat(v,"translationY",end);
  jumpAnimator.setDuration(300);
  jumpAnimator.setInterpolator(new AnticipateInterpolator());
  jumpAnimator.start();
}

代码示例来源:origin: peng8350/JPTabBar

@Override
public void onSelectChanged(View v, boolean selected) {
  int end = selected ? 360 : 0;
  ObjectAnimator rotateAnimator = ObjectAnimator.ofFloat(v, "rotation",  end);
  rotateAnimator.setDuration(400);
  rotateAnimator.setInterpolator(new AnticipateInterpolator());
  rotateAnimator.start();
}

代码示例来源:origin: com.willowtreeapps/oak-demos

@Override
  public void onStateChange(int state) {
    if (state == AnimatedSvgView.STATE_FILL_STARTED) {
      ViewHelper.setAlpha(mSubtitleView, 0);
      mSubtitleView.setVisibility(View.VISIBLE);
      //mSubtitleView.setTranslationX(-mSubtitleView.getWidth());
      // Bug in older versions where set.setInterpolator didn't work
      AnimatorSet set = new AnimatorSet();
      Interpolator interpolator = new AccelerateInterpolator();
      ObjectAnimator a1 = ObjectAnimator.ofFloat(mLogoView, "translationX", 0);
      ObjectAnimator a2 = ObjectAnimator.ofFloat(mSubtitleView, "translationX", 0);
      ObjectAnimator a3 = ObjectAnimator.ofFloat(mSubtitleView, "alpha", 1);
      a1.setInterpolator(interpolator);
      a2.setInterpolator(interpolator);
      set.setDuration(500).playTogether(a1, a2, a3);
      set.start();
      if (mOnFillStartedCallback != null) {
        mOnFillStartedCallback.run();
      }
    }
  }
});

代码示例来源:origin: Y-bao/PullRefreshView

public static Animator startScale(final View view, float fromScale, float toScale, long duration, long startDelay, Interpolator setInterpolator) {
  ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "scaleX", fromScale, toScale).setDuration(duration);
  objectAnimator.setStartDelay(startDelay);
  objectAnimator.setInterpolator(setInterpolator);
  objectAnimator.start();
  objectAnimator = ObjectAnimator.ofFloat(view, "scaleY", fromScale, toScale).setDuration(duration);
  objectAnimator.setStartDelay(startDelay);
  objectAnimator.setInterpolator(setInterpolator);
  objectAnimator.start();
  return objectAnimator;
}

代码示例来源:origin: Y-bao/PullRefreshView

public static Animator startRotation(View view, float toRotation, long duration, long startDelay, int times) {
  ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "rotation", ViewHelper.getRotation(view), toRotation).setDuration(duration);
  objectAnimator.setStartDelay(startDelay);
  objectAnimator.setRepeatCount(times);
  objectAnimator.setInterpolator(new LinearInterpolator());
  objectAnimator.start();
  return objectAnimator;
}

代码示例来源:origin: Y-bao/PullRefreshView

public static Animator startScale(final View view, float toScale, long duration, long startDelay, Interpolator setInterpolator) {
  ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "scaleX", ViewHelper.getScaleX(view), toScale).setDuration(duration);
  objectAnimator.setStartDelay(startDelay);
  objectAnimator.setInterpolator(setInterpolator);
  objectAnimator.start();
  objectAnimator = ObjectAnimator.ofFloat(view, "scaleY", ViewHelper.getScaleY(view), toScale).setDuration(duration);
  objectAnimator.setStartDelay(startDelay);
  objectAnimator.setInterpolator(setInterpolator);
  objectAnimator.start();
  return objectAnimator;
}

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

private void startNeedleAnimator() {
  if (isPlaying) {
    mNeedleAnimator = ObjectAnimator.ofFloat(mNeedle, "rotation", 0, NEEDLE_ROTATE_CIRCLE);
  } else {
    mNeedleAnimator = ObjectAnimator.ofFloat(mNeedle, "rotation", NEEDLE_ROTATE_CIRCLE, 0);
  }
  mNeedleAnimator.setDuration(NEEDLE_ANIMATOR_TIME);
  mNeedleAnimator.setInterpolator(new DecelerateInterpolator());
  if (mNeedleAnimator.isRunning() || mNeedleAnimator.isStarted()) {
    mNeedleAnimator.cancel();
  }
  mNeedleAnimator.start();
}

代码示例来源: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: vinaygaba/CreditCardView

private void rotateInToFrontBeforeEleven() {
  com.nineoldandroids.animation.AnimatorSet set = new com.nineoldandroids.animation.AnimatorSet();
  final com.nineoldandroids.animation.ObjectAnimator rotateIn = com.nineoldandroids.animation.ObjectAnimator.ofFloat(this, "rotationY", 0, 90);
  final com.nineoldandroids.animation.ObjectAnimator hideBackView = com.nineoldandroids.animation.ObjectAnimator.ofFloat(this, "alpha", 1, 0);
  rotateIn.setInterpolator(new AccelerateDecelerateInterpolator());
  rotateIn.setDuration(300);
  hideBackView.setDuration(1);
  set.addListener(new com.nineoldandroids.animation.Animator.AnimatorListener() {
    @Override
    public void onAnimationStart(com.nineoldandroids.animation.Animator animation) {
    }
    @Override
    public void onAnimationEnd(com.nineoldandroids.animation.Animator animation) {
      rotateOutToFrontBeforeEleven();
    }
    @Override
    public void onAnimationCancel(com.nineoldandroids.animation.Animator animation) {
    }
    @Override
    public void onAnimationRepeat(com.nineoldandroids.animation.Animator animation) {
    }
  });
  set.play(hideBackView).after(rotateIn);
  set.start();
}

代码示例来源:origin: vinaygaba/CreditCardView

private void rotateInToBackBeforeEleven() {
  com.nineoldandroids.animation.AnimatorSet set = new com.nineoldandroids.animation.AnimatorSet();
  final com.nineoldandroids.animation.ObjectAnimator rotateIn = com.nineoldandroids.animation.ObjectAnimator.ofFloat(this, "rotationY", 0, 90);
  final com.nineoldandroids.animation.ObjectAnimator hideFrontView = com.nineoldandroids.animation.ObjectAnimator.ofFloat(this, "alpha", 1, 0);
  rotateIn.setInterpolator(new AccelerateDecelerateInterpolator());
  rotateIn.setDuration(300);
  hideFrontView.setDuration(1);
  set.addListener(new com.nineoldandroids.animation.Animator.AnimatorListener() {
    @Override
    public void onAnimationStart(com.nineoldandroids.animation.Animator animation) {
    }
    @Override
    public void onAnimationEnd(com.nineoldandroids.animation.Animator animation) {
      rotateOutToBackBeforeEleven();
    }
    @Override
    public void onAnimationCancel(com.nineoldandroids.animation.Animator animation) {
    }
    @Override
    public void onAnimationRepeat(com.nineoldandroids.animation.Animator animation) {
    }
  });
  set.play(hideFrontView).after(rotateIn);
  set.start();
}

相关文章