我有一个AnimatorSet和几个ObjectAnimators。我看不出它们持续时间的区别。有人能给我解释一下吗?
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="together">
<objectAnimator
android:propertyName="translationY"
android:duration="1000"
android:interpolator="@android:interpolator/bounce"
android:repeatCount="3"
android:valueFrom="0.0"
android:valueTo="-600.0"
android:repeatMode="reverse"
android:valueType="floatType"/>
<objectAnimator
android:propertyName="alpha"
android:duration="1000"
android:interpolator="@android:interpolator/linear"
android:repeatCount="3"
android:valueFrom="1.0"
android:valueTo="0.0"
android:repeatMode="reverse"
android:valueType="floatType"
/>
</set>
val rocketAnimatorSet = AnimatorInflater.loadAnimator(this, R.animator.jump_and_blink) as AnimatorSet
val dogeAnimatorSet = AnimatorInflater.loadAnimator(this, R.animator.jump_and_blink) as AnimatorSet
rocketAnimatorSet.setTarget(rocket)
dogeAnimatorSet.setTarget(doge)
val animatorSet = AnimatorSet()
animatorSet.playTogether(rocketAnimatorSet, dogeAnimatorSet)
animatorSet.duration =9000L
animatorSet.start()
1条答案
按热度按时间wfveoks01#
我认为主要的区别是AnimatorSet提供了方法
playTogether
来合并很多ObjectAnimators或set tag(<set></set>
)来包含多个objectAnimators。希望这个有帮助!AnimatiorSet ref
ObjectAnimator ref