applyInterpolation method

  1. @override
void applyInterpolation(
  1. ActorComponent? component,
  2. double time,
  3. KeyFrame toFrame,
  4. double mix,
)
override

Implementation

@override
void applyInterpolation(
    ActorComponent? component, double time, KeyFrame toFrame, double mix) {
  ColorStroke cs = component as ColorStroke;
  Float32List wr = cs.color;
  Float32List to = (toFrame as KeyFrameStrokeColor)._value;
  int len = _value.length;

  double f =
      _interpolator.getEasedMix((time - _time) / (toFrame.time - _time));
  double fi = 1.0 - f;
  if (mix == 1.0) {
    for (int i = 0; i < len; i++) {
      wr[i] = _value[i] * fi + to[i] * f;
    }
  } else {
    double mixi = 1.0 - mix;
    for (int i = 0; i < len; i++) {
      double v = _value[i] * fi + to[i] * f;

      wr[i] = wr[i] * mixi + v * mix;
    }
  }
  cs.markPaintDirty();
}