AnimationClip constructor

AnimationClip(
  1. String name, [
  2. num duration = -1,
  3. List<KeyframeTrack>? tracks,
  4. int blendMode = NormalAnimationBlendMode,
])

name - a name for this clip.

duration - the duration of this clip (in seconds). If a negative value is passed, the duration will be calculated from the passed tracks array.

tracks - an array of KeyframeTracks.

blendMode - defines how the animation is blended/combined when two or more animations are simultaneously played.

Note: Instead of instantiating an AnimationClip directly with the constructor, you can use one of its static methods to create AnimationClips: from JSON (parse), from morph target sequences (createFromMorphTargetSequence, createClipsFromMorphTargetSequences) or from animation hierarchies (parseAnimation) - if your model doesn't already hold AnimationClips in its geometry's animations array.

Implementation

AnimationClip(this.name,[this.duration = -1, List<KeyframeTrack>? tracks, this.blendMode = NormalAnimationBlendMode]) {
  this.tracks = tracks ?? [];

  uuid = MathUtils.generateUUID();

  // this means it should figure out its duration by scanning the tracks
  if (duration < 0) {
    resetDuration();
  }
}