createAnimationClip method

AnimationClip createAnimationClip(
  1. Animation animation,
  2. Node bindTarget
)

Instantiates animation as an AnimationClip bound to bindTarget and registers it with this player.

The clip starts paused at time 0; call AnimationClip.play to begin playback. Subsequent calls with the same Animation.name replace the previously registered clip.

Implementation

AnimationClip createAnimationClip(Animation animation, Node bindTarget) {
  final clip = AnimationClip(animation, bindTarget);

  // Record the default transforms this clip will mutate. Nodes already
  // bound by another clip keep their recorded bind pose; re-capturing here
  // would snapshot the current (possibly mid-playback, animated) transform
  // as the rest pose and corrupt the blend baseline for every clip.
  for (final binding in clip._bindings) {
    _targetTransforms.putIfAbsent(
      binding.node,
      () => AnimationTransforms(bindPose: _bindPoseOf(binding.node)),
    );
  }

  _clips[animation.name] = clip;
  return clip;
}