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

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

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

ObjectAnimator.setEvaluator介绍

暂无

代码示例

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

/**
 * Constructs and returns an ObjectAnimator that animates between Object values. A single
 * value implies that that value is the one being animated to. Two values imply a starting
 * and ending values. More than two values imply a starting value, values to animate through
 * along the way, and an ending value (these values will be distributed evenly across
 * the duration of the animation).
 *
 * @param target The object whose property is to be animated.
 * @param property The property being animated.
 * @param evaluator A TypeEvaluator that will be called on each animation frame to
 * provide the necessary interpolation between the Object values to derive the animated
 * value.
 * @param values A set of values that the animation will animate between over time.
 * @return An ObjectAnimator object that is set up to animate between the given values.
 */
public static <T, V> ObjectAnimator ofObject(T target, Property<T, V> property,
    TypeEvaluator<V> evaluator, V... values) {
  ObjectAnimator anim = new ObjectAnimator(target, property);
  anim.setObjectValues(values);
  anim.setEvaluator(evaluator);
  return anim;
}

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

/**
 * Constructs and returns an ObjectAnimator that animates between Object values. A single
 * value implies that that value is the one being animated to. Two values imply a starting
 * and ending values. More than two values imply a starting value, values to animate through
 * along the way, and an ending value (these values will be distributed evenly across
 * the duration of the animation).
 *
 * @param target The object whose property is to be animated. This object should
 * have a public method on it called <code>setName()</code>, where <code>name</code> is
 * the value of the <code>propertyName</code> parameter.
 * @param propertyName The name of the property being animated.
 * @param evaluator A TypeEvaluator that will be called on each animation frame to
 * provide the necessary interpolation between the Object values to derive the animated
 * value.
 * @param values A set of values that the animation will animate between over time.
 * @return An ObjectAnimator object that is set up to animate between the given values.
 */
public static ObjectAnimator ofObject(Object target, String propertyName,
    TypeEvaluator evaluator, Object... values) {
  ObjectAnimator anim = new ObjectAnimator(target, propertyName);
  anim.setObjectValues(values);
  anim.setEvaluator(evaluator);
  return anim;
}

代码示例来源:origin: com.nineoldandroids/library

/**
 * Constructs and returns an ObjectAnimator that animates between Object values. A single
 * value implies that that value is the one being animated to. Two values imply a starting
 * and ending values. More than two values imply a starting value, values to animate through
 * along the way, and an ending value (these values will be distributed evenly across
 * the duration of the animation).
 *
 * @param target The object whose property is to be animated.
 * @param property The property being animated.
 * @param evaluator A TypeEvaluator that will be called on each animation frame to
 * provide the necessary interpolation between the Object values to derive the animated
 * value.
 * @param values A set of values that the animation will animate between over time.
 * @return An ObjectAnimator object that is set up to animate between the given values.
 */
public static <T, V> ObjectAnimator ofObject(T target, Property<T, V> property,
    TypeEvaluator<V> evaluator, V... values) {
  ObjectAnimator anim = new ObjectAnimator(target, property);
  anim.setObjectValues(values);
  anim.setEvaluator(evaluator);
  return anim;
}

代码示例来源:origin: com.nineoldandroids/library

/**
 * Constructs and returns an ObjectAnimator that animates between Object values. A single
 * value implies that that value is the one being animated to. Two values imply a starting
 * and ending values. More than two values imply a starting value, values to animate through
 * along the way, and an ending value (these values will be distributed evenly across
 * the duration of the animation).
 *
 * @param target The object whose property is to be animated. This object should
 * have a public method on it called <code>setName()</code>, where <code>name</code> is
 * the value of the <code>propertyName</code> parameter.
 * @param propertyName The name of the property being animated.
 * @param evaluator A TypeEvaluator that will be called on each animation frame to
 * provide the necessary interpolation between the Object values to derive the animated
 * value.
 * @param values A set of values that the animation will animate between over time.
 * @return An ObjectAnimator object that is set up to animate between the given values.
 */
public static ObjectAnimator ofObject(Object target, String propertyName,
    TypeEvaluator evaluator, Object... values) {
  ObjectAnimator anim = new ObjectAnimator(target, propertyName);
  anim.setObjectValues(values);
  anim.setEvaluator(evaluator);
  return anim;
}

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

t.setEvaluator(ArgbEvaluator.getInstance());

相关文章