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;
}