Animation constructor

Animation({
  1. required List<AnimationData> animations,
  2. required double x,
  3. required double y,
  4. int index = 0,
  5. double originX = 0.5,
  6. double originY = 0.5,
  7. int opacity = 255,
  8. double scale = 1.0,
  9. double rotation = 0,
})

Implementation

Animation({
  required List<AnimationData> animations,
  required super.x,
  required super.y,
  int index = 0,
  super.originX = 0.5,
  super.originY = 0.5,
  super.opacity = 255,
  super.scale = 1.0,
  super.rotation = 0,
})  : assert(animations.isNotEmpty, "you have to provide atleast 1 AnimationData"),
      _index = index,
      _timer = index.toDouble(),
      _animations = Map.fromEntries(animations.map((e) => MapEntry(e.key, e))),
      _state = animations.first.key,
      super(texture: animations.first.frames[index]);