change speed of sprite using time parameter in sprite sheet

Hi,

wondering if its possible to change the “time” parameter in the spritesheet data? for example:

sequences.movement =
    {
        name = “movement”,
        start = 1,
        count = 2,
        time = 1000, -------CHANGE TO VALUE-----
        loopCount = 0,
        loopDirection = “forward”
    }

Is it possible to use:

time = a

then use a as a variable value to change the speed of the sprite when a change occurs in the game?

local a =1000

if enemyCount == 10 then

sequences.movement.time = 2000 ETC ETC

Or do I have to create seperate animations with just the time var altered ?

thanks

ok, seems I can pass it values no issues, but do I have to stop the sheet before applying the new value?

Can it not be done on the fly? dosnt seem so with my experiments

If not what is the best practice to do this please?

Use the .timeScale property to modify the speed of the sprite animation. Works perfectly (check the docs, it’s super easy).

Hi N,

never noticed .timeScale ever before.

However I use the new APis for sprites but cant seem to find a similar thing for those, maybe I am looking in the wrong place?

ok no worries I found it…thankyou

Here’s the documentation page (last item in the Properties category). This is for the new sprite APIs.

http://docs.coronalabs.com/api/type/SpriteObject/index.html

ok, seems I can pass it values no issues, but do I have to stop the sheet before applying the new value?

Can it not be done on the fly? dosnt seem so with my experiments

If not what is the best practice to do this please?

Use the .timeScale property to modify the speed of the sprite animation. Works perfectly (check the docs, it’s super easy).

Hi N,

never noticed .timeScale ever before.

However I use the new APis for sprites but cant seem to find a similar thing for those, maybe I am looking in the wrong place?

ok no worries I found it…thankyou

Here’s the documentation page (last item in the Properties category). This is for the new sprite APIs.

http://docs.coronalabs.com/api/type/SpriteObject/index.html