flux is a fast, lightweight tweening library for Lua
The flux.lua file should be added to an existing Love2d project and required by it.
flux = require "flux"
it should also be updated in love.update(dt)
function love.update(dt)
flux.update(dt)
end
To tween an object's value you should call the flux.to() function in love.load()
local square = {x = 10, y = 40}
function love.load()
flux.to(square, 4, { x = 200, y = 300 })
end
function love.update(dt)
flux.update(dt)
end
function love.draw()
love.graphics.rectangle("fill", square.x, square.y, 30, 30)
end
The top code will move the square object from the coordinates (10, 40) to (200, 300) over 4 seconds.
note: you must always specify whatever you want to tween in brackets or it wont work
If you want to read more about flux options you should go read the documentation over at it's github page