setInterpolation method

dynamic setInterpolation(
  1. dynamic interpolation
)

Implementation

setInterpolation(interpolation) {
  Function(dynamic result)? factoryMethod;

  switch (interpolation) {
    case InterpolateDiscrete:
      factoryMethod = interpolantFactoryMethodDiscrete;

      break;

    case InterpolateLinear:
      factoryMethod = interpolantFactoryMethodLinear;

      break;

    case InterpolateSmooth:
      factoryMethod = interpolantFactoryMethodSmooth;

      break;
  }

  if (factoryMethod == null) {
    var message = 'unsupported interpolation for $valueTypeName keyframe track named $name';

    if (createInterpolant == null) {
      // fall back to default, unless the default itself is messed up
      if (interpolation != defaultInterpolation) {
        setInterpolation(defaultInterpolation);
      } else {
        throw (message); // fatal, in this case

      }
    }

    print('three.KeyframeTrack: $message');
    return this;
  }

  createInterpolant = factoryMethod;

  return this;
}