I would like to know an algorithm for smooth damp or as some people call it, tween. I would like it in Lua preferably but anything will help.
I have tried watching unity
If I understand the question correctly, you're looking for an easing function. There is a Lua library that provides a set of easing functions on GitHub: https://github.com/EmmanuelOga/easing
An example would be:
local function inOutQuad(t, b, c, d)
t = t / d * 2
if t < 1 then
return c / 2 * pow(t, 2) + b
else
return -c / 2 * ((t - 1) * (t - 3) - 1) + b
end
end
Where t = time, b = begin value, c = change in value, and d = duration.
More information on these easing functions is available directly from Robert Penner here (this is where the function above is derived from): http://www.robertpenner.com/easing/