Multiple position animations [SOLVED}

I’d like to animate a tank to make it vibrate. The intent is to have it animate vertically by one pixel, but occasionally animate horizontally by one pixel.

This is the code I’ve tried…

tankPos.x = tankPos.x-1;|
go.animate("/tank", “position”, go.PLAYBACK_LOOP_PINGPONG, tankPos, go.EASING_INOUTSINE, .1)|
tankPos.y = tankPos.y-1;|
go.animate("/tank", “position”, go.PLAYBACK_LOOP_PINGPONG, tankPos, go.EASING_INOUTSINE, .15)|

What I’m seeing is only the vertical animation. My guess is that the second call to go.animate obliterates the first call because they both affect ‘position’. There’s not a way to animate along two different axes at different rates, is there?

You can use “position.x” and “position.y” instead, and pass integers instead of vec3s. Any time you animate a property, it cancels any ongoing animations of that property.

6 Likes