AnimationAction constructor

AnimationAction(
  1. AnimationMixer mixer,
  2. AnimationClip clip, {
  3. Object3D? localRoot,
  4. int? blendMode,
})

Implementation

AnimationAction(AnimationMixer mixer, AnimationClip clip,
    {Object3D? localRoot, int? blendMode}) {
  blendMode ??= clip.blendMode;

  _mixer = mixer;
  _clip = clip;
  _localRoot = localRoot;
  this.blendMode = blendMode;

  var tracks = clip.tracks, nTracks = tracks.length;

  var interpolants = List<Interpolant?>.filled(nTracks, null);

  var interpolantSettings = {
    "endingStart": ZeroCurvatureEnding,
    "endingEnd": ZeroCurvatureEnding
  };

  for (var i = 0; i != nTracks; ++i) {
    var interpolant = tracks[i].createInterpolant!(null);
    interpolants[i] = interpolant;
    interpolant.settings = interpolantSettings;
  }

  _interpolantSettings = interpolantSettings;

  _interpolants = interpolants; // bound by the mixer

  // inside: PropertyMixer (managed by the mixer)
  _propertyBindings = List<PropertyMixer?>.filled(nTracks, null);

  _cacheIndex = null; // for the memory manager
  _byClipCacheIndex = null; // for the memory manager

  _timeScaleInterpolant = null;
  _weightInterpolant = null;

  loop = LoopRepeat;
  _loopCount = -1;

  // global mixer time when the action is to be started
  // it's set back to 'null' upon start of the action
  _startTime = null;

  // scaled local time of the action
  // gets clamped or wrapped to 0..clip.duration according to loop
  time = 0;

  timeScale = 1;
  _effectiveTimeScale = 1;

  weight = 1;
  _effectiveWeight = 1;

  repetitions = double.infinity; // no. of repetitions when looping

  paused = false; // true -> zero effective time scale
  enabled = true; // false -> zero effective weight

  clampWhenFinished = false; // keep feeding the last frame?

  zeroSlopeAtStart = true; // for smooth interpolation w/o separate
  zeroSlopeAtEnd = true; // clips for start, loop and end

  backwards = false; // GL
}