buildSubAnimation function

Animation<double> buildSubAnimation(
  1. AnimationController controller,
  2. Duration begin,
  3. Duration end,
  4. Curve curve,
)

Builds a sub-animation to the provided controller that runs from start to end, with the provided curve. For example, it could create an animation that runs from 300ms to 800ms with an easeOut curve, within a controller that has a total duration of 1000ms.

Mostly used by EffectEntry and Effect classes.

Implementation

Animation<double> buildSubAnimation(
  AnimationController controller,
  Duration begin,
  Duration end,
  Curve curve,
) {
  int ttlT = controller.duration?.inMicroseconds ?? 0;
  int beginT = begin.inMicroseconds, endT = end.inMicroseconds;
  return CurvedAnimation(
    parent: controller,
    curve: Interval(beginT / ttlT, endT / ttlT, curve: curve),
  );
}