Version
- Operating system: Windows 11
Description
When providing durations in animations using an array of frames rather than total duration or FPS, the timing is generally slower than it should, sometimes by over several hundreds of ms or more. This is especially noticeable for quick and snappy animations making it impossible to define animation durations per frame this way.
This scales with the number of frames given to anims.create()
EXAMPLE:
this.anims.create({
key: 'walk',
frames: [
{ key: 'brawler', frame: 0, duration: 200 },
{ key: 'brawler', frame: 1, duration: 100 },
{ key: 'brawler', frame: 2, duration: 200 },
{ key: 'brawler', frame: 3, duration: 100 },
],
repeat: 0
});
For each frame, the time is extended by 40ms.
So a 10 frame animation will have a total runtime of about 400ms longer.
Example Test Code
EXAMPLE JsFiddle
Simply refresh, the time displayed on screen should match the total duration for all the frames. In the fiddle is should be 2400ms, but the animation completes in about 3000ms on Chrome or Firefox browser.
Version
Description
When providing durations in animations using an array of frames rather than total duration or FPS, the timing is generally slower than it should, sometimes by over several hundreds of ms or more. This is especially noticeable for quick and snappy animations making it impossible to define animation durations per frame this way.
This scales with the number of frames given to anims.create()
EXAMPLE:
For each frame, the time is extended by 40ms.
So a 10 frame animation will have a total runtime of about 400ms longer.
Example Test Code
EXAMPLE JsFiddle
Simply refresh, the time displayed on screen should match the total duration for all the frames. In the fiddle is should be 2400ms, but the animation completes in about 3000ms on Chrome or Firefox browser.