暂停/反转帧动画?
我有一个使用 AnimationDrawable 可以完美播放的帧动画。这里是:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="@drawable/arrowframes0000" android:duration="50" />
<item android:drawable="@drawable/arrowframes0001" android:duration="50" />
...
<item android:drawable="@drawable/arrowframes0024" android:duration="50" />
<item android:drawable="@drawable/arrowframes0025" android:duration="50" />
我需要能够在该帧动画仍在播放时以及在完成后不久的其他情况下反转该动画。
似乎没有任何方法可以使用 AnimationDrawable 来做到这一点。
我还能如何做到这一点,以便我可以在播放过程中反转动画? (并使其在倒放过程中再次前进)。
I have a frame animation that plays perfectly fine using AnimationDrawable. Here it is:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="@drawable/arrowframes0000" android:duration="50" />
<item android:drawable="@drawable/arrowframes0001" android:duration="50" />
...
<item android:drawable="@drawable/arrowframes0024" android:duration="50" />
<item android:drawable="@drawable/arrowframes0025" android:duration="50" />
I need to be able to reverse this frame animation while it is still playing and in other circumstances shortly after it is done.
There doesn't seem to be any way to do this using AnimationDrawable.
How else can I do this so that i can reverse the animation mid-playback? (and make it go forward again mid-reverseplayback).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用反向帧创建另一个相同的重复动画当你想要反转已经运行的动画时,停止你想要反转的动画(即正在运行的动画)&启动重复的反向(即第二个)动画。
create another same duplicate animation with reverse frame & when you want to reverse the already running animation, stop which one you want to reverse(i.e the running one) & start duplicate reverse(i.e. 2nd) animation.
我已经以这种方式为我做到了这一点,即最后一个可绘制的“arrowframes0025”延长了持续时间(比如2000),这将使其停止2秒,并继续以相同的持续时间(50)按降序放置您的可绘制对象,这将使完整的前进-后退动画和保持 oneshot 为 false
I have done this for me in this way i.e. at last drawable "arrowframes0025" expand the duration (say 2000) this will make it stop for 2 second and continue placing your drawables in descending order with same duration (50) this will make the complete forward-reverse animation & keep oneshot as false