bool AttributeAnimationInfo::Update(float timeStep) { if (!animation_) return true; currentTime_ += timeStep * speed_; if (!animation_->IsValid()) return true; bool finished = false; // Calculate scale time by wrap mode float scaledTime = CalculateScaledTime(currentTime_, finished); animatable_->OnSetAttribute(attributeInfo_, animation_->GetAnimationValue(scaledTime)); if (animation_->HasEventFrames()) { PODVector<const VAnimEventFrame*> eventFrames; GetEventFrames(lastScaledTime_, scaledTime, eventFrames); for (unsigned i = 0; i < eventFrames.Size(); ++i) animatable_->SendEvent(eventFrames[i]->eventType_, const_cast<VariantMap&>(eventFrames[i]->eventData_)); } lastScaledTime_ = scaledTime; return finished; }
bool ValueAnimationInfo::Update(float timeStep) { if (!animation_ || !target_) return true; currentTime_ += timeStep * speed_; if (!animation_->IsValid()) return true; bool finished = false; // Calculate scale time by wrap mode float scaledTime = CalculateScaledTime(currentTime_, finished); // Apply to the target object ApplyValue(animation_->GetAnimationValue(scaledTime)); // Send keyframe event if necessary if (animation_->HasEventFrames()) { PODVector<const VAnimEventFrame*> eventFrames; GetEventFrames(lastScaledTime_, scaledTime, eventFrames); for (unsigned i = 0; i < eventFrames.Size(); ++i) target_->SendEvent(eventFrames[i]->eventType_, const_cast<VariantMap&>(eventFrames[i]->eventData_)); } lastScaledTime_ = scaledTime; return finished; }