Skip to content

Commit 69da862

Browse files
author
minggo
authored
fix action running times for instant actions (#17849)
1 parent 013d852 commit 69da862

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cocos/2d/CCActionInterval.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,13 +596,14 @@ void RepeatForever::startWithTarget(Node* target)
596596
void RepeatForever::step(float dt)
597597
{
598598
_innerAction->step(dt);
599-
if (_innerAction->isDone())
599+
// only action interval should prevent jerk, issue #17808
600+
if (_innerAction->isDone() && _innerAction->getDuration() > 0)
600601
{
601602
float diff = _innerAction->getElapsed() - _innerAction->getDuration();
602603
if (diff > _innerAction->getDuration())
603604
diff = fmodf(diff, _innerAction->getDuration());
604605
_innerAction->startWithTarget(_target);
605-
// to prevent jerk. issue #390, 1247
606+
// to prevent jerk. cocos2d-iphone issue #390, 1247
606607
_innerAction->step(0.0f);
607608
_innerAction->step(diff);
608609
}

0 commit comments

Comments
 (0)