简体   繁体   English

如何为android圆形显示动画的运动设置动画

[英]How to animate movement of android circular reveal animation

I'm using reveal animation in api 21 to above, to animate view revealing with nice circular animation.我在上面的 api 21 中使用了显示动画,以使用漂亮的圆形动画为视图显示设置动画。

But when I try to animate the position of the view, Circular reveal animation will not animate correctly and show's wrong frames (miss behavior with margins!).但是,当我尝试为视图的位置设置动画时,圆形显示动画将无法正确设置动画并显示错误的帧(丢失带有边距的行为!)。

I'm using ValueAnimator and update view margins in its updateListener for translation.我正在使用 ValueAnimator 并在其 updateListener 中更新视图边距以进行翻译。

I'm looking for the best practice to play moving animation parallel with circular reveal animation.我正在寻找与圆形显示动画并行播放移动动画的最佳实践。

Finally figured it out !终于想通了!

Using ViewPropertyAnimator solved the problem.使用 ViewPropertyAnimator 解决了这个问题。

final Animator anim = ViewAnimationUtils
   .createCircularReveal(animatedView, startPos[0], startPos[1], initRadius, targetRadius);
myView.animate().x(100).y(100);
anim.start();

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

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