Skip to content

Commit 5eabc61

Browse files
zeeker999huangwei1024
authored andcommitted
Fix animation duration calculation (cocos2d#19221)
The duration of action will be miscalculated when float abs(float) is unavailble, replacing it with std::abs fixes the issue.
1 parent 67adbb0 commit 5eabc61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cocos/2d/CCActionInterval.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void ExtraAction::step(float /*dt*/)
8989
bool ActionInterval::initWithDuration(float d)
9090
{
9191

92-
_duration = abs(d) <= MATH_EPSILON ? MATH_EPSILON : d;
92+
_duration = std::abs(d) <= MATH_EPSILON ? MATH_EPSILON : d;
9393
_elapsed = 0;
9494
_firstTick = true;
9595
_done = false;

0 commit comments

Comments
 (0)