progress method

  1. @override
double progress(
  1. Entity entity,
  2. AnimatorComponent animator,
  3. AnimatorState state
)
override

How far through state's clip entity is, 0–1; a looping clip counts on past 1, so an exit time is reached once and stays reached.

Implementation

@override
double progress(
  Entity entity,
  AnimatorComponent animator,
  AnimatorState state,
) {
  final p = entity.getComponent<AnimationPlayerComponent>()!;
  if (p.isBlending) return p.cycles + p.phase;
  if (p.duration <= 0) return 0;
  return p.cycles + p.time / p.duration;
}