Beginner question on iterations parameter in transition.to function

Hi,

  Seriously embarrased to ask this but I don’t understand why this isn’t iterating six times??

local square = display.newRect(0, 0, 100, 100 )
square:setFillColor(math.random(250), math.random(250), math.random(250))
transition.to(square, {time = 2000, y = 400, iterations = 6, transition = easing.outBounce})

I’m using Sublime 3 (with the Corona Package).

No error comes up when I run the main.lua file

Hi @coronasdknewbie,

This transition actually is occurring 6 times, but you’re setting a strict location (y=400) so the last 5 iterations will appear to do nothing (the object is not actually changing its position at all). If you need to move it in some sort of sequence, then consider using y values that are offset from the object’s current position, like y=square.y+50.

Hope this helps,

Brent

Hi again!

  I figured out the solution. I was using a very old SDK version. After downloading the newest public release and rerunning the code the iterations came out working perfectly. Whew! While racking my brain trying to figure out why this very simple code isn’t iterating, I was losing my motivation to make my millions. Now I’m back on track! :slight_smile: I plan to upgrade to developer version when I’m ready to actually code a game. For now I’m just wanting to use the starter to learn the APIs.

Thank you for your assistance!

Hi @coronasdknewbie,

This transition actually is occurring 6 times, but you’re setting a strict location (y=400) so the last 5 iterations will appear to do nothing (the object is not actually changing its position at all). If you need to move it in some sort of sequence, then consider using y values that are offset from the object’s current position, like y=square.y+50.

Hope this helps,

Brent

Hi again!

  I figured out the solution. I was using a very old SDK version. After downloading the newest public release and rerunning the code the iterations came out working perfectly. Whew! While racking my brain trying to figure out why this very simple code isn’t iterating, I was losing my motivation to make my millions. Now I’m back on track! :slight_smile: I plan to upgrade to developer version when I’m ready to actually code a game. For now I’m just wanting to use the starter to learn the APIs.

Thank you for your assistance!