MCPcopy Create free account
hub / github.com/axmolengine/axmol / update

Method update

core/3d/Animate3D.cpp:298–424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298void Animate3D::update(float t)
299{
300 if (_target)
301 {
302 if (_state == Animate3D::Animate3DState::FadeIn && _lastTime > 0.f)
303 {
304 _accTransTime += (t - _lastTime) * getDuration();
305
306 _weight = _accTransTime / _transTime;
307 if (_weight >= 1.0f)
308 {
309 _accTransTime = _transTime;
310 _weight = 1.0f;
311 _state = Animate3D::Animate3DState::Running;
312 s_fadeInAnimates.erase(_target);
313 s_runningAnimates[_target] = this;
314 }
315 }
316 else if (_state == Animate3D::Animate3DState::FadeOut && _lastTime > 0.f)
317 {
318 _accTransTime += (t - _lastTime) * getDuration();
319
320 _weight = 1 - _accTransTime / _transTime;
321 if (_weight <= 0.0f)
322 {
323 _accTransTime = _transTime;
324 _weight = 0.0f;
325
326 s_fadeOutAnimates.erase(_target);
327 _target->stopAction(this);
328 return;
329 }
330 }
331 float lastTime = _lastTime;
332 _lastTime = t;
333
334 if (_quality != Animate3DQuality::QUALITY_NONE)
335 {
336 if (_weight > 0.0f)
337 {
338 float transDst[3], rotDst[4], scaleDst[3];
339 float *trans = nullptr, *rot = nullptr, *scale = nullptr;
340 if (_playReverse)
341 {
342 t = 1 - t;
343 lastTime = 1.0f - lastTime;
344 }
345
346 t = _start + t * _last;
347 lastTime = _start + lastTime * _last;
348
349 for (const auto& it : _boneCurves)
350 {
351 auto bone = it.first;
352 auto curve = it.second;
353 if (curve->translateCurve)
354 {
355 curve->translateCurve->evaluate(t, transDst, _translateEvaluate);

Callers

nothing calls this directly

Calls 15

getInstanceFunction · 0.85
setAnimationValueMethod · 0.80
scaleMethod · 0.80
getDurationFunction · 0.70
sortFunction · 0.50
eraseMethod · 0.45
stopActionMethod · 0.45
evaluateMethod · 0.45
translateMethod · 0.45
rotateMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected