Why is this transition so fast?

In my estimation (and possibly experience, though that could just be bad memory) changing the size of a group should be a consistent transition, similar to changing the scale. However, this appears to be extremely fast (whereas scaling is not) and would point to a cumulative effect when using a transition. I was hoping to simply make this group more narrow, but it happens much fast than the time set in the transition parameters. Any ideas anyone?

a = display.newGroup() a.x, a.y = display.actualCenterX, display.actualCenterY display.newRect( a, 0, 0, display.actualContentWidth, 50 ) print(a.width,display.actualContentWidth,a[1].width) transition.to( a, { time=5000, xScale=0 } ) -- should take 5 seconds, is much quicker

It seems to be taking 5 seconds when I run it in the sim. I tried adding an onComplete function to track how much time was passing:

a = display.newGroup() a.x, a.y = display.contentCenterX, display.contentCenterY display.newRect( a, 0, 0, display.actualContentWidth, 50 ) print(a.width,display.actualContentWidth,a[1].width) local startTime = system.getTimer() local function onComplete() local endTime = system.getTimer() local totalTime = endTime - startTime print(totalTime) end transition.to( a, { time=5000, xScale=0, onComplete = onComplete } ) -- should take 5 seconds, is much quicker

It finished at 5002.309ms. I assume it goes slightly over depending on how long the frame time is, but I think most people would be ok with an extra 2ms. 

Are you sure there is not something else in your code that could be causing the issue?

If the visual impression is that it is too fast, you might consider changing the easing from linear to one of the *Circ or *Quad options.

I think scaling is tricky like that.  The brain tells you it is changing non-linearly, when it is linear.

-Ed

Ok, so I can’t believe I didn’t notice this for so long, but this is the code causing the problem… The scaling isn’t an issue - the width change is the issue. The code above (in my first post) is fine.

a = display.newGroup() a.x, a.y = display.actualCenterX, display.actualCenterY display.newRect( a, 0, 0, display.actualContentWidth, 50 ) print(a.width,display.actualContentWidth,a[1].width) transition.to( a, { time=5000, width=0 } ) -- should take 5 seconds, is much quicker

It seems to be taking 5 seconds when I run it in the sim. I tried adding an onComplete function to track how much time was passing:

a = display.newGroup() a.x, a.y = display.contentCenterX, display.contentCenterY display.newRect( a, 0, 0, display.actualContentWidth, 50 ) print(a.width,display.actualContentWidth,a[1].width) local startTime = system.getTimer() local function onComplete() local endTime = system.getTimer() local totalTime = endTime - startTime print(totalTime) end transition.to( a, { time=5000, xScale=0, onComplete = onComplete } ) -- should take 5 seconds, is much quicker

It finished at 5002.309ms. I assume it goes slightly over depending on how long the frame time is, but I think most people would be ok with an extra 2ms. 

Are you sure there is not something else in your code that could be causing the issue?

If the visual impression is that it is too fast, you might consider changing the easing from linear to one of the *Circ or *Quad options.

I think scaling is tricky like that.  The brain tells you it is changing non-linearly, when it is linear.

-Ed

Ok, so I can’t believe I didn’t notice this for so long, but this is the code causing the problem… The scaling isn’t an issue - the width change is the issue. The code above (in my first post) is fine.

a = display.newGroup() a.x, a.y = display.actualCenterX, display.actualCenterY display.newRect( a, 0, 0, display.actualContentWidth, 50 ) print(a.width,display.actualContentWidth,a[1].width) transition.to( a, { time=5000, width=0 } ) -- should take 5 seconds, is much quicker