When I used the transition.to function, I don’t see the display object move when I expect it. I’ve read that that transition time s 500 msec but in my app I don’t see the movement until much later.
The ShowCoverBlocks() function below is called from my enterFrame handler, every 16 msec. I expected to see the blocks move after 4 seconds and then again at 6 seconds. Originally, I saw no movement of the blocks at all. After I commented out the lines that reset the blocks’ position (at the end of the function) I discovered that the transition.to function had moved the blocks, but I didn’t see the new position until 10’s of seconds later, after the blocks had been made invisible, then visible again (by the operation of the CoverFlags).
Does transition.to work with some kind of display update scheduler? Maybe I shouldn’t call transition.to from an enterFrame handler?
Dan
Sample code:
– Decide if we should see any cover blocks
local function ShowCoverBlocks()
– handle each cover block
for i = 1, 10 do
if ((CoverFlags[i]) and (CoverKeepAwayTimes[i] == 0)) then
– make it visible. Also, time to move it?
if (CoveredTimes[i] > 6000) then
– move it
transition.to(CoverBlocks[i], {
x = ScreenWidth*5/8,
width = ScreenWidth*3/4})
CoverBlocks[i].isVisible = true
elseif (CoveredTimes[i] > 4000) then
– move it
transition.to(CoverBlocks[i], {
x = ScreenWidth*3/4,
width = ScreenWidth/2})
CoverBlocks[i].isVisible = true
elseif (CoveredTimes[i] > 2000) then
– just make it visible
CoverBlocks[i].isVisible = true
end
else
– make it invisible
CoverBlocks[i].isVisible = false
– and reset its position
--transition.to(CoverBlocks[i], {
--x = ScreenWidth*7/8,
--width = ScreenWidth/4})
end
end
end