本文整理汇总了Java中android.animation.ValueAnimator.setObjectValues方法的典型用法代码示例。如果您正苦于以下问题:Java ValueAnimator.setObjectValues方法的具体用法?Java ValueAnimator.setObjectValues怎么用?Java ValueAnimator.setObjectValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.ValueAnimator
的用法示例。
在下文中一共展示了ValueAnimator.setObjectValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startCloudTemplate
import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void startCloudTemplate(String mapTag, long delay, final CircleInfo circleInfo){
ValueAnimator valueAnimator=animMap.get(mapTag);
if (valueAnimator==null){
valueAnimator=ValueAnimator.ofObject(new CircleTypeEvaluator(circleInfo),new CircleInfo(circleInfo.getX(),circleInfo.getY()+circleInfo.getRadius(),0)
,new CircleInfo(circleInfo.getX(),circleInfo.getY(),circleInfo.getRadius()));
valueAnimator.setDuration(600);
valueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
circleInfo.setCanDraw(true);
}
});
animMap.put(mapTag,valueAnimator);
}
valueAnimator.setObjectValues(new CircleInfo(circleInfo.getX(),circleInfo.getY()+circleInfo.getRadius(),0)
,new CircleInfo(circleInfo.getX(),circleInfo.getY(),circleInfo.getRadius()));
valueAnimator.setStartDelay(delay);
startValueAnimator(valueAnimator);
}
示例2: setCodeSegment
import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void setCodeSegment(final TextView codeView, String segment) {
if (Build.VERSION.SDK_INT >= 11) {
ValueAnimator valueAnimator = new ValueAnimator();
valueAnimator.setObjectValues(0, Integer.parseInt(segment));
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int value = (int) animation.getAnimatedValue();
codeView.setText(String.format("%05d", value));
}
});
valueAnimator.setEvaluator(new TypeEvaluator<Integer>() {
public Integer evaluate(float fraction, Integer startValue, Integer endValue) {
return Math.round(startValue + (endValue - startValue) * fraction);
}
});
valueAnimator.setDuration(1000);
valueAnimator.start();
} else {
codeView.setText(segment);
}
}