update method
void
update(
- num time,
- num deltaTime,
- num timeDirection,
- int accuIndex,
)
Implementation
void update(num time, num deltaTime, num timeDirection, int accuIndex) {
// called by the mixer
if (!enabled) {
// call ._updateWeight() to update ._effectiveWeight
_updateWeight(time);
return;
}
final startTime = _startTime;
if (startTime != null) {
// check for scheduled start of action
final timeRunning = (time - startTime) * timeDirection;
if (timeRunning < 0 || timeDirection == 0) {
deltaTime = 0;
}
else{
// start
_startTime = null; // unschedule
deltaTime = timeDirection * timeRunning;
}
}
// apply time scale and advance time
deltaTime *= _updateTimeScale(time);
final clipTime = _updateTime(deltaTime);
// note: _updateTime may disable the action resulting in
// an effective weight of 0
double weight = _updateWeight(time);
if (weight > 0) {
final interpolants = this.interpolants;
final propertyMixers = propertyBindings;
switch (blendMode) {
case AdditiveAnimationBlendMode:
for (int j = 0, m = interpolants.length; j != m; ++j) {
interpolants[j]!.evaluate(clipTime);
propertyMixers[j]!.accumulateAdditive(weight);
}
break;
case NormalAnimationBlendMode:
default:
for (int j = 0; j < interpolants.length; ++j) {
interpolants[j]!.evaluate(clipTime);
propertyMixers[j]!.accumulate(accuIndex, weight);
}
}
}
}