Transition.moveto Question

I have the transition below which moves my rock from its starting position to the x position below (moves left to right).  Then it starts back at the beginning and repeats continuously.

slidingRock1 = transition.to( rock1, { time=4000, x=468, iterations=-1, transition=continuousLoop} )

What I would like it to do is when it transitions to x=468 I would like it to move right to left back to x=300 and repeat these two back and forth movements continuously.

I’ve been playing around with the transitions but I can’t seem to make this back move.

Any suggestions?

Thanks,

Lori

Hi Lori,

Does the rock begin at x=300? If so, you should be able to just use “continuousLoop” and it will keep going back and forth. I don’t think there would be any reason for the “iterations” parameter (try removing that).

Take care,

Brent

Yes the rock begins at x=300.  I tried removing the iterations and used as below and it just moves left to right one time and stops.

slidingRock1 = transition.to( rock1, { time=4000, x=468,  transition=continuousLoop} )

Hi Lori,

Now that I recall, there may be a few lingering bugs in the “continuousLoop” easing method. As such, you may want to set up a quick function which handles the onComplete event for the transition, then sends it back and forth repeatedly. Another advantage of that approach would be the ability to use other easing methods like “outQuad” to make the rock oscillate on a non-linear transition, like it’s swinging back and forth gradually, instead of just moving at a constant back-and-forth.

Brent

OK.  I’ll give that a try.  Thanks

Hi Lori,

Does the rock begin at x=300? If so, you should be able to just use “continuousLoop” and it will keep going back and forth. I don’t think there would be any reason for the “iterations” parameter (try removing that).

Take care,

Brent

Yes the rock begins at x=300.  I tried removing the iterations and used as below and it just moves left to right one time and stops.

slidingRock1 = transition.to( rock1, { time=4000, x=468,  transition=continuousLoop} )

Hi Lori,

Now that I recall, there may be a few lingering bugs in the “continuousLoop” easing method. As such, you may want to set up a quick function which handles the onComplete event for the transition, then sends it back and forth repeatedly. Another advantage of that approach would be the ability to use other easing methods like “outQuad” to make the rock oscillate on a non-linear transition, like it’s swinging back and forth gradually, instead of just moving at a constant back-and-forth.

Brent

OK.  I’ll give that a try.  Thanks