update method

dynamic update(
  1. dynamic time,
  2. dynamic deltaTime,
  3. dynamic timeDirection,
  4. dynamic accuIndex,
)

Implementation

update(time, deltaTime, timeDirection, accuIndex) {
  // called by the mixer

  if (!enabled) {
    // call ._updateWeight() to update ._effectiveWeight

    _updateWeight(time);
    return;
  }

  var startTime = _startTime;

  if (startTime != null) {
    // check for scheduled start of action

    var timeRunning = (time - startTime) * timeDirection;
    if (timeRunning < 0 || timeDirection == 0) {
      return; // yet to come / don't decide when delta = 0

    }

    // start

    _startTime = null; // unschedule
    deltaTime = timeDirection * timeRunning;
  }

  // apply time scale and advance time

  deltaTime *= _updateTimeScale(time);
  var clipTime = _updateTime(deltaTime);

  // note: _updateTime may disable the action resulting in
  // an effective weight of 0

  var weight = _updateWeight(time);

  if (weight > 0) {
    var propertyMixers = propertyBindings;

    switch (blendMode) {
      case AdditiveAnimationBlendMode:
        for (var j = 0, m = interpolants.length; j != m; ++j) {
          // print("AnimationAction j: ${j} ${interpolants[ j ]} ${propertyMixers[ j ]} ");

          interpolants[j]!.evaluate(clipTime);
          propertyMixers[j]!.accumulateAdditive(weight);
        }

        break;

      case NormalAnimationBlendMode:
      default:
        for (var j = 0, m = interpolants.length; j != m; ++j) {
          // print("AnimationAction22 j: ${j} ${interpolants[ j ]} ${propertyMixers[ j ]} ");

          interpolants[j]!.evaluate(clipTime);

          //  print("AnimationAction22 j: ${j} ----- ");

          propertyMixers[j]!.accumulate(accuIndex, weight);
        }
    }
  }
}