delta time is simple module for time based animations for Corona SDK. It is supposed to work with enterFrame event.
This function returns the actual number of milliseconds that have gone by since the previous frame.
Start counting delta time from 0. It is useful if you don't use deltatime.getTime()
for a while.
local dt = require( 'deltatime' )
local player = display.newRect( 100, 100, 50, 50 )
local function loop( event )
-- Move player object 50 pixels per second
local dx = 50 * dt.getTime()
player:translate( dx, 0 )
end
Runtime:addEventListener( 'enterFrame', loop )
To run code you need install Corona SDK
This project is licensed under the MIT License - see the LICENSE.md file for details.