标签:
target |
The object whose property is to be animated. This object should have a public method on it called setName() , where name is
the value of the propertyName parameter. |
---|---|
propertyName | The name of the property being animated. |
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. |
values | A set of values that the animation will animate between over time. |
<span style="font-size:14px;"><span style="font-size:18px;">ObjectAnimator animator = ObjectAnimator.ofFloat(textview, "rotation", 0f, 360f); animator.setDuration(5000); animator.start(); </span></span>x轴平移动画:
<span style="font-size:14px;"><span style="font-size:18px;">float curTranslationX = textview.getTranslationX(); ObjectAnimator animator = ObjectAnimator.ofFloat(textview, "translationX", curTranslationX, -500f, curTranslationX); animator.setDuration(5000); animator.start(); </span></span>
<span style="font-size:14px;">ObjectAnimator animator = ObjectAnimator.ofFloat(textview, "scaleY", 1f, 3f, 1f); animator.setDuration(5000); animator.start(); </span>
ObjectAnimator.ofFloat(textview, "alpha", 1f, 0f); animator.setDuration(5000); animator.start();
<span style="font-size:14px;"><span style="font-size:18px;">ObjectAnimator moveIn = ObjectAnimator.ofFloat(textview, "translationX", -500f, 0f); ObjectAnimator rotate = ObjectAnimator.ofFloat(textview, "rotation", 0f, 360f); ObjectAnimator fadeInOut = ObjectAnimator.ofFloat(textview, "alpha", 1f, 0f, 1f); AnimatorSet animSet = new AnimatorSet(); animSet.play(rotate).with(fadeInOut).after(moveIn); animSet.setDuration(5000); animSet.start(); </span></span>
对属性动画ObjectAnimator.ofObject方法的学习和理解
标签:
原文地址:http://blog.csdn.net/chen_zhang_yu/article/details/51366527