getAnimatedExtent method

double getAnimatedExtent(
  1. TKey key,
  2. double fullExtent
)

Gets the animated extent for a node.

If the node is animating, returns the interpolated extent. Otherwise returns fullExtent.

Implementation

double getAnimatedExtent(TKey key, double fullExtent) {
  // 1. Check bulk animation group
  if (_bulkAnimationGroup?.members.contains(key) == true) {
    return fullExtent * _bulkAnimationGroup!.value;
  }

  // 2. Check operation group
  final groupKey = _operationGroupOf(key);
  if (groupKey != null) {
    final group = _operationGroups[groupKey];
    if (group != null) {
      final member = group.members[key];
      if (member != null) {
        return member.computeExtent(group.curvedValue, fullExtent);
      }
    }
  }

  // 3. Check standalone animations
  final animation = _standaloneAt(key);
  if (animation == null) return fullExtent;

  final t = animationCurve.transform(animation.progress.clamp(0.0, 1.0));
  if (animation.targetExtent == _unknownExtent) {
    return animation.type == AnimationType.entering
        ? fullExtent * t
        : fullExtent * (1.0 - t);
  }
  return lerpDouble(animation.startExtent, animation.targetExtent, t)!;
}