apply method

  1. @override
void apply(
  1. AnimationTransforms target,
  2. double timeInSeconds,
  3. double weight
)
override

Resolve and apply the property value to a target node. This operation is additive; a given node property may be amended by many different PropertyResolvers prior to rendering. For example, an AnimationPlayer may blend multiple Animations together by applying several AnimationClips.

Implementation

@override
void apply(AnimationTransforms target, double timeInSeconds, double weight) {
  if (_values.isEmpty) {
    return;
  }

  _TimelineKey key = _getTimelineKey(timeInSeconds);
  Vector3 value = _values[key.index];
  if (key.lerp < 1) {
    value = _values[key.index - 1].lerp(value, key.lerp);
  }

  Vector3 scale =
      Vector3(1, 1, 1).lerp(value.divided(target.bindPose.scale), weight);

  target.animatedPose.scale = Vector3(
      target.animatedPose.scale.x * scale.x,
      target.animatedPose.scale.y * scale.y,
      target.animatedPose.scale.z * scale.z);
}