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

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

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

ObjectAnimator.setDuration介绍

[英]Sets the length of the animation. The default duration is 300 milliseconds.
[中]设置动画的长度。默认持续时间为300毫秒。

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

public void showLeft() {
 translateWidgets(leftWidth, left, middle, right);
 ObjectAnimator.ofInt(this, "middleWidth", leftWidth,
            middleWidthNormal).setDuration(ANIM_DURATION)
        .start();
}

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

public void animateCheck() {
  changeBackground();
  ObjectAnimator objectAnimator;
  if (eventCheck) {
    objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xFin);
  } else {
    objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xIni);
  }
  objectAnimator.setDuration(300);
  objectAnimator.start();
}

代码示例来源: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: 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: commonsguy/cw-omnibus

public void hideLeft() {
 if (leftWidth == -1) {
  leftWidth=left.getWidth();
  middleWidthNormal=middle.getWidth();
  resetWidget(left, leftWidth);
  resetWidget(middle, middleWidthNormal);
  resetWidget(right, middleWidthNormal);
  requestLayout();
 }
 translateWidgets(-1 * leftWidth, left, middle, right);
 ObjectAnimator.ofInt(this, "middleWidth", middleWidthNormal,
            leftWidth).setDuration(ANIM_DURATION).start();
}

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

ViewHelper.setX(progressView,getWidth()+progressView.getWidth()/2);
animation = ObjectAnimator.ofFloat(progressView, "x", -progressView.getWidth()/2);
animation.setDuration(1200);
animation.addListener(new AnimatorListener() {

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

progressView.startAnimation(anim);
final ObjectAnimator anim2 = ObjectAnimator.ofFloat(progressView, "x", getWidth());
anim2.setDuration(1200);
anim2.addListener(new AnimatorListener() {

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

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
  from = position - 1;
  if(from != NO_VALUE && to != NO_VALUE) {
    objectAnimator = timelyView.animate(from, to);
    objectAnimator.setDuration(DURATION);
  } else {
    objectAnimator = null;
  }
}

代码示例来源: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: tomahawk-player/tomahawk-android

@Override
  public void run() {
    // now calculate the animation goal and instantiate the animation
    int initialY = 0;
    ValueAnimator animator = ObjectAnimator.ofFloat(getLayedOutView(), "y",
        initialY, view.getHeight() / -3)
        .setDuration(10000);
    animator.setInterpolator(new LinearInterpolator());
    addAnimator(ANIM_IMAGEVIEW_ID, animator);
    refreshAnimations();
  }
});

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

public static Animator startHide(final View view, long duration, long startDelay) {
  view.setVisibility(View.VISIBLE);
  ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "alpha", ViewHelper.getAlpha(view), 0f).setDuration(duration);
  objectAnimator.setStartDelay(startDelay);
  objectAnimator.start();
  return objectAnimator;
}

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

public static Animator startShow(View view, float fromAlpha, long duration, long startDelay) {
  ViewHelper.setAlpha(view, fromAlpha);
  view.setVisibility(View.VISIBLE);
  ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "alpha", fromAlpha, 1f).setDuration(duration);
  objectAnimator.setStartDelay(startDelay);
  objectAnimator.start();
  return objectAnimator;
}

代码示例来源: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: 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: 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: 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: xuehuayous/PullToRefresh-Demo

@Override
public void onPull(float scaleOfLayout) {
  if(scaleOfLayout < 0.7f) scaleOfLayout = 0.7f;
  if(scaleOfLayout > 1.0f) scaleOfLayout = 1.0f;
  //旋转动画
  ViewHelper.setPivotX(mPointerImage, mPointerImage.getMeasuredWidth()/2);  // 设置中心点
  ViewHelper.setPivotY(mPointerImage, mPointerImage.getMeasuredHeight()/2);
  ObjectAnimator animPY = ObjectAnimator.ofFloat(mPointerImage, "rotation", 0, 250).setDuration(300);
  animPY.setCurrentPlayTime((long) (scaleOfLayout * 1000 - 700));
}

相关文章