Animation constructor

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

Implementation

Animation({
  required List<AnimationData> animations,
  required super.position,
  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.name, e))),
      _state = animations.first.name,
      super(texture: animations.first.frames[index]);