crude video
just realized that the timer.timeScale() function only works when iterations are set to infinite. will correct tonight if possible
Thank jstrahan. I tried with delay paramater on a transition and that results in an error. Not so sure how easy that is to fix, might be tricky?
can you post an example. did you download the new file
I have a newer file that has example project and couple new options that I plan to upload tonight so if something isn’t working id like to try and fix before I upload
I’m using the example from your site, the newest version. Downloaded again now just to be sure and still there.
So if you chance line 17 to
[lua]local trans = transition.to( ball, {delay = 5000, time = 10000, x = 300} )[/lua]
and uncomment line 22
[lua]transition.timeScale( trans, 2)[/lua]
You get error:
Runtime error
/Users/jonjonsson/Downloads/apiExtend (1)/_apiExtend.lua:27: bad argument #1 to ‘pairs’ (table expected, got nil)
stack traceback:
[C]: in function ‘pairs’
/Users/jonjonsson/Downloads/apiExtend (1)/_apiExtend.lua:27: in function ‘timeScale’
/Users/jonjonsson/Downloads/apiExtend (1)/main.lua:22: in main chunk
ok it must be that there’s no _keysStart table until after the delay. to work around delay the timeScale until the transition starts and maybe i can make it so timeScale gets delayed automatically in future code. thanks for the response.
ok just updated file. it was an easy fix to have it delay the timeScale automatically. also added the ability to use trans:timeScale(0.5). slightly different demo file to play with. enjoy and let me know of any other issues you come across.
also added a version number to top of code and zip filename to make it easier to know if you have the newest version. current version i called 0.3
trans:timeScale is nice addition.
I do think that the timeScaling of transition should also scale the delay param in the transition. What do you think?
done. version 0.31 uploaded
Some problem with delay in 31.
This code:
[lua]require’_apiExtend’
local ball = display.newCircle( 20, 20, 10 )
local trans = transition.to( ball, {delay = 5000, time = 20000, x = 300, onComplete = function()
ball.fill = {1,0,0,1}
end } )
trans:timeScale(0.5)[/lua]
Gives you:
Runtime error
/Users/jonjonsson/Downloads/_apiExtend0_31/_apiExtend.lua:41: attempt to perform arithmetic on global ‘ts’ (a nil value)
stack traceback:
/Users/jonjonsson/Downloads/_apiExtend0_31/_apiExtend.lua:41: in function ‘timeScale’
/Users/jonjonsson/Downloads/_apiExtend0_31/main.lua:9: in main chunk
sorry move line 29 to just above function new:timeScale(…)
updating file now
0.32 gives error on this code
[lua]display.setStatusBar( display.HiddenStatusBar )
require’_apiExtend’
local seconds = display.newText(“0”, 100, 100)
local x = 1
timer.performWithDelay( 1000, function() seconds.text = x; x = x + 1 end, 0)
local ball = display.newCircle( 20, 20, 10 )
local trans = transition.to( ball, {delay = 4000, time = 4000, x = 300, onComplete = function()
ball.fill = {1,0,0,1}
end } )
trans:timeScale(0.5)[/lua]
This should start the ball at 2 seconds and complete everything in 4 seconds right? I put a seconds counter as well.
This code gives error:
Runtime error
/Users/jonjonsson/Downloads/_apiExtend0_32/_apiExtend.lua:32: bad argument #1 to ‘pairs’ (table expected, got nil)
stack traceback:
[C]: in function ‘pairs’
/Users/jonjonsson/Downloads/_apiExtend0_32/_apiExtend.lua:32: in function ‘_listener’
?: in function <?:141>
?: in function <?:218>
I have to go out for the day, I’ll give it ago again tonight or in the morning.
ok I know what’s wrong. will take me a bit to correct
version 0.33 uploaded. i had to add a 30millisecond delay to give the keysStart table time to be created. i tested with my main and your main seems to be working now
There are still some problems with delay, not errors but functioning not quite as expected. See comments in code. Maybe its not worth supporting delay, its up to you
[lua]display.setStatusBar( display.HiddenStatusBar )
require’_apiExtend’
local seconds = display.newText(“0”, 100, 100)
local x = 1
timer.performWithDelay( 1000, function() seconds.text = x; x = x + 1 end, 0)
local ball = display.newCircle( 20, 20, 10 )
local trans = transition.to( ball, {delay = 4000, time = 4000, x = 300, onComplete = function()
ball.fill = {1,0,0,1}
end } )
– Starts at second 4 correctly but remaining should be 2 seconds for 6 total (is 8)
timer.performWithDelay(4000, function() trans:timeScale(0.5) end)
– This should start at second 3 instead of 2
–timer.performWithDelay(2000, function() trans:timeScale(0.5) end)[/lua]