Skip to content

Commit

Permalink
Cleaned Animation.advanceTime()
Browse files Browse the repository at this point in the history
Removed useless _isPlaying check & simplified call of updateVisuals()

Author: wastedabuser
Refs SammyJoeOsborne#2
  • Loading branch information
Adolio committed Jan 24, 2015
1 parent fe44946 commit b9e67a7
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/com/sammyjoeosborne/spriter/Animation.as
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,16 @@ package com.sammyjoeosborne.spriter
_currentTime += $time * _playDirection;
normalizeCurrentTime();
//if we aren't looping and we're going over the length of the animation
if (!_loop && _isPlaying)
if (!_loop)
{
//if not looping, only update if current time is not past the last frame's time (whether we're playing forward or backward)
//if we're playing forward and the current time is >= the last keyframe's time, do not update. Just return.
if (_playDirection >= 0 && (_currentTime >= mainKeys[_lastFrameIndex].time)) return;
//if we're playing backward and current time is somehow less than 0, don't update. Just return.
else if (_playDirection < 0 && (_currentTime < 0)) return;

updateVisuals();
}
//if the animation hasn't been stopped by this point, carry on
if(_loop)
{
updateVisuals();
}

updateVisuals();
}

public function getNextFrame():MainKey
Expand Down

0 comments on commit b9e67a7

Please sign in to comment.