tweenTo method

void tweenTo(
  1. double t
)

A tween's progress, 0 to 1: each mark's value between what it was and what it is, on the scale of where it is going.

Implementation

void tweenTo(double t) {
  final to = _tweenTo, from = _tweenFrom;
  if (to == null || from == null) return;
  if (t >= 1) {
    rows = to;
    _tweenFrom = _tweenTo = null;
    _changed();
    return;
  }
  final fields = _markFields;
  final key = spec.key;
  rows = [
    for (final r in to)
      {
        ...r,
        for (final f in fields)
          if (r[f] case final num now when now.isFinite)
            f: () {
              final was = from[r[key]]?[f];
              final a = was is num && was.isFinite ? was.toDouble() : 0.0;
              return a + (now - a) * t;
            }(),
      },
  ];
  _changed();
}