Best Speed Method

Hi guys,
i have a object that i want to have go from a 0 speed up to a 4 speed as you hold a button down. i know how to do this with basic code, but it goes instantly from 0 to 4, what would i use so this is progressive? i want to make it so as you are holding down the button it takes x number of seconds to speed up the object from 0 to 4. would the transition.to be used in this case? i havent used it.
any advice or suggestions would be appreciated, thanks [import]uid: 19620 topic_id: 5765 reply_id: 305765[/import]

It depends how exactly you have things coded. If you are using Corona’s built-in physics then simply use addForce to add to the speed progressively. If you are doing your own programmatic animation, you want to have separate variables for speed and acceleration. Move the object using speed each frame, but use acceleration to change the speed each frame:

local block = display.newImage("block.png") local spd = 0 local accel = .1 local function move(event) block.y = block.y + spd spd = spd + accel end Runtime:addEventListener("enterFrame", move) [import]uid: 12108 topic_id: 5765 reply_id: 19766[/import]

ok great example, i actually am using coronas built in physics so i want to use the addForce, is there a page that has all of these commands? such as applyLinearImpluse, etc… it would be cool to just have a page that says them all and explains their function.
could you give me a quick example of how the addforce would be put to use? [import]uid: 19620 topic_id: 5765 reply_id: 19767[/import]

http://developer.anscamobile.com/content/game-edition-box2d-physics-engine [import]uid: 12108 topic_id: 5765 reply_id: 19796[/import]