Skip to content

Delta Time is very simple module for time based animations for Corona SDK

License

Notifications You must be signed in to change notification settings

ldurniat/delta-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

delta-time

delta time is simple module for time based animations for Corona SDK. It is supposed to work with enterFrame event.

deltatime.getTime()

This function returns the actual number of milliseconds that have gone by since the previous frame.

deltatime.restart()

Start counting delta time from 0. It is useful if you don't use deltatime.getTime() for a while.

Example:

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 )

Run

To run code you need install Corona SDK

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

Delta Time is very simple module for time based animations for Corona SDK

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages