简体   繁体   English

视图的AnimationSet

[英]AnimationSet for Views

I know it is possible to run series of animation at same time with animationset like this : 我知道可以使用animationset同时运行一系列动画:

AnimationSet animationSet = new AnimationSet(true);
                                animationSet.addAnimation(new RotateAnimation(this,0));
                                /**
                                 * more animation
                                 */
                                animationSet.addAnimation(new RotateAnimation(this,90));
                                animationSet.start();

I want to achieve something similar with viewanimator (animated series of views at same time) : 我想用viewanimator(同时经过动画处理的一系列视图)实现类似的功能:

ViewPropertyAnimator a = v.animate().rotation(0).setDuration(500);

Is there a way I can achieve this ? 有没有办法可以做到这一点?

If only one or two properties on a View object are being animated, then using an ObjectAnimator is fine.But if several properties are animated simultaneously, or if you just want a more convenient syntax to animate a specific property, then ViewPropertyAnimator might be more well-suited to the task. 如果只对View对象的一个​​或两个属性进行动画处理,则可以使用ObjectAnimator;但是如果同时对多个属性进行动画处理,或者如果您只想使用更方便的语法为特定属性设置动画,则ViewPropertyAnimator可能会更好-适合任务。

    view.animate().scaleX(2).scaleY(4).rotation(180).
    setDuration(3000).setInterpolator(new 
    AccelerateDecelerateInterpolator()).start();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM