Animation constructor
Animation({})
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]);