lerp method

String lerp(
  1. double t
)
override

Returns the value this variable has at the given animation clock value.

The default implementation of this method uses the +, -, and * operators on T. The begin and end properties must therefore be non-null by the time this method is called.

In general, however, it is possible for this to return null, especially when t=0.0 and begin is null, or t=1.0 and end is null.

Implementation

String lerp(double t) {
  var strBuilder = StringBuffer();
  int strLen;
  if (begin!.length <= end!.length) {
    strLen = begin!.length + ((end!.length - begin!.length) * t).round();
  } else {
    strLen = begin!.length - ((begin!.length - end!.length) * t).round();
  }
  for (int i = 0; i < strLen; i++) {
    if (begin!.length > i) {
      strBuilder.write(positionToAlphabet[lerpDouble(
              alphabetToPosition[begin![i]],
              end!.length > i
                  ? alphabetToPosition[end![i]]
                  : _random.nextInt(alphabetToPosition.length),
              t)
          !.round()]);
    } else {
      strBuilder.write(t == 1
          ? end![i]
          : positionToAlphabet[_random.nextInt(alphabetToPosition.length)]);
    }
  }
  return strBuilder.toString();
}