Samarium
Yes, I have already added this to my spritesheet preset method:
# ...
array.push({ time: framesWidth * duration })
#...
Result:
const anim = (direction: Direction, framesWidth: number, duration: number = 5) => {
const array: any = []
for (let i = 0; i < framesWidth; i++) {
array.push({ time: i * duration, frameX: i, frameY: frameY(direction) })
}
array.push({ time: framesWidth * duration })
return array
}