如何在android中创建燃烧燃料动画的火箭

时间:2017-07-12 13:06:49

标签: android android-animation

我需要制造一个火箭从屏幕底部向上顶升,燃料从其下端弹出。我创造了火箭动画,但我不知道如何实现后者。感谢

public void rocketLaunch() {

    final ObjectAnimator rotate = ObjectAnimator.ofFloat(rocket, "translationY", 100f, -1400f); //150f,-80f
    rotate.setInterpolator(new AnticipateOvershootInterpolator());
    rotate.setRepeatCount(1); 
    rotate.setDuration(8000); 

    rotate.start();

}

2 个答案:

答案 0 :(得分:0)

此动画需要大约6张图片。每一个火箭的火焰都会进一步出现。

将图像放入列表

获取要将此图像应用到的节点。

在可运行的计时器处理程序&使用while或for循环,告诉节点每0.25秒(或更快)显示列表中的下一个图像

答案 1 :(得分:0)

动画由许多静止图像组成,也称为帧,在指定的时间段内逐个显示。

帧间经过的时间称为帧刷新延迟 - 默认情况下,属性动画为10 ms。

在动画开始时,火箭位于屏幕的底部边缘 每一帧,火箭的位置向上移动了相同的路径部分 到动画结束时,火箭位于屏幕的上边缘。

enter image description here

遵循本教程
https://www.raywenderlich.com/128105/introduction-android-animations