mirror of https://github.com/axmolengine/axmol.git
Merge pull request #12040 from geron-cn/v3
fix bug: fix actiontimeline can not step to last frame when loop play
This commit is contained in:
commit
8e3e928efd
|
@ -199,23 +199,28 @@ void ActionTimeline::step(float delta)
|
|||
}
|
||||
|
||||
_time += delta * _timeSpeed;
|
||||
|
||||
if(_time < _endFrame * _frameInternal)
|
||||
const float endtoffset = _time - _endFrame * _frameInternal;
|
||||
|
||||
if (endtoffset < _frameInternal)
|
||||
{
|
||||
_currentFrame = (int)(_time / _frameInternal);
|
||||
stepToFrame(_currentFrame);
|
||||
if (endtoffset >= 0 && _lastFrameListener != nullptr) // last frame
|
||||
_lastFrameListener();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_lastFrameListener != nullptr)
|
||||
_lastFrameListener();
|
||||
|
||||
_playing = _loop;
|
||||
if(!_playing)
|
||||
if (!_playing)
|
||||
{
|
||||
_time = _endFrame * _frameInternal;
|
||||
_currentFrame = (int)(_time / _frameInternal);
|
||||
stepToFrame(_currentFrame);
|
||||
if (_currentFrame != _endFrame)
|
||||
{
|
||||
_currentFrame = _endFrame;
|
||||
stepToFrame(_currentFrame);
|
||||
if (_lastFrameListener != nullptr) // last frame
|
||||
_lastFrameListener();
|
||||
}
|
||||
}
|
||||
else
|
||||
gotoFrameAndPlay(_startFrame, _endFrame, _loop);
|
||||
|
|
Loading…
Reference in New Issue