02-07-2020, 08:22 AM
I'm glad it worked
Yes, timing units is somewhat inconsistent. A bit of history: at first I intended timing to be units agnostic. You just had to match the units in TLN_DrawFrame() call, with the units in the sequence description. But then I added the ability load sequences embedded in Tiled tilemap's tsx files, that are expressed in milliseconds, and internally convert them to frames assuming a rate of 60 fps. This allowed me to load these sequences easily, but that's not always right.
For your animations, for converting milliseconds to frames:
frame = milliseconds*60/1000;
Yes, timing units is somewhat inconsistent. A bit of history: at first I intended timing to be units agnostic. You just had to match the units in TLN_DrawFrame() call, with the units in the sequence description. But then I added the ability load sequences embedded in Tiled tilemap's tsx files, that are expressed in milliseconds, and internally convert them to frames assuming a rate of 60 fps. This allowed me to load these sequences easily, but that's not always right.
- Working in frames has the advantage that they're deterministic, all frames have same duration and equally spaced, but the speed depends on refresh rate
- Working in absolute time (milliseconds) has the advantage that speed doesn't depend on refresh rate, but the resulting animation can have some jitter, as there isn't an integer relationship between milliseconds and frames.
For your animations, for converting milliseconds to frames:
frame = milliseconds*60/1000;