View Full Version : Animate a plane along an endless line

30th December 2010, 17:18
I'm quite new to QML and I'm trying to program a little game.

I'm trying to animate a plane flying along an endless line. If the rotation of the plane changes the plane updates it's path (line). I implemented this feature in js, but the problem is that the animations are never smooth.

Using any animation like NumberAnimation the plane moves very smooth, but these Animations are all from-to based, so I can move from A to B but I cannot (or I dont know how) move the plane continuous along an endless line using a NumberAnimation.

Any suggestions?


30th December 2010, 20:15
Please explain more what you mean by an endless line. A screen has a limited width and height so if you call something as "endless" you surely have some special meaning for it.

31st December 2010, 11:34
My plane has a rotation from 0-360 degree. I what that the plane flies in this rotation direction.

So if it has a rotation of 90 degree it moves along the x axis to the right...


31st December 2010, 12:11
So the end point of the current animation is an intersection of the vector of its direction and the edge of the screen. Whenever the direction changes, update the end point. Note that using SmoothedAnimation might be better than NumberAnimation.