Love the new Tween library, a welcome addition and nicely integrated into the existing Codea suite of tools. The easing functions are fantastic! Well done chaps!
Was curious if there’s a way of querying the current state of a Tween? More specifically, if there is an easy way of returning a normalised percentage (i.e 0 → 1) of how far the Tween has got when interpolating between Value A and Value B over time?
I’m trying to refactor my existing game code which uses a much less sophisticated Tween type library that I wrote, but returns a normalised percentage value which I use a fair bit on each update cycle.
Think that’s nailed it @mpilgrem - thanks. Basically, it’s simply elapsed time/duration (as per my original code) but on a tween by tween basis. Nice
Out of curiosity, the docs mention that the Tween function returns the ‘TweenId’ as a table of which it seems 'running and ‘time’ are return values within this. Is this documented anywhere? Couldn’t seem to easily find a reference to this in the docs.
time
running
initial -- table (the initial state of subject)
subject -- table
target -- table
easing -- function
args -- table (the optional arguments to the callback function)
loop -- function (tween.loop.once by default)