I'm calling it tween.lua . It's available here:
https://github.com/kikito/tween.lua
"tweening" is an animation tecnique consisting on "interpolating" from one initial value to a 'target'. The way in which you approach that target may be defined via an easing function.
Here's a sample .love file: And here's some basic usage sample code:
Code: Select all
tween = require 'tween'
function love.update(dt)
...
tween.update(dt)
...
end
function love.load()
hero = {x=100, y = 200}
tween(4, hero, {x=200}) -- move the hero 100 pixels to the left, in 4 seconds
end
Notice that tween is a "callable table" (some people call them functables). tween(...) is a shortcut to tween.start(...).
Thanks a lot to Emmanuel Oga for providing with the easing functions!
Regards!
EDIT: BlackBulletIV pointed out some embarrassing privacy issue on the library (one variable was global instead of local). I've fixed this on the library and on the demo.
EDIT2: Added a new demo with font effects