createAnimationWithVariableStepTimes method

SpriteAnimation createAnimationWithVariableStepTimes({
  1. required int row,
  2. required List<double> stepTimes,
  3. bool loop = true,
  4. int from = 0,
  5. int? to,
})

Creates a SpriteAnimation from this SpriteSheet, using the sequence of sprites on a given row with different duration for each.

from and to can be specified to create an animation from a subset of the columns on the row

Implementation

SpriteAnimation createAnimationWithVariableStepTimes({
  required int row,
  required List<double> stepTimes,
  bool loop = true,
  int from = 0,
  int? to,
}) {
  final spriteList = _generateSpriteList(
    row: row,
    to: to,
    from: from,
  );

  return SpriteAnimation.variableSpriteList(
    spriteList,
    loop: loop,
    stepTimes: stepTimes,
  );
}