mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Fixed animations where the frame stays the same for periods of time.
This commit is contained in:
parent
d77b87ed22
commit
4b87607599
1 changed files with 7 additions and 7 deletions
|
@ -196,27 +196,27 @@ module.exports = class SegmentedSprite extends createjs.SpriteContainer
|
|||
else
|
||||
newFrame = newFrame % @animLength
|
||||
|
||||
return if @currentFrame is newFrame
|
||||
translatedFrame = newFrame
|
||||
|
||||
if @frames
|
||||
prevFrame = Math.floor(newFrame)
|
||||
nextFrame = Math.ceil(newFrame)
|
||||
if prevFrame is nextFrame
|
||||
@baseMovieClip.gotoAndStop(@frames[newFrame])
|
||||
translatedFrame = @frames[newFrame]
|
||||
else if nextFrame is @frames.length
|
||||
@baseMovieClip.gotoAndStop(@frames[prevFrame])
|
||||
translatedFrame = @frames[prevFrame]
|
||||
else
|
||||
# interpolate between frames
|
||||
pct = newFrame % 1
|
||||
newFrameIndex = @frames[prevFrame] + (pct * (@frames[nextFrame] - @frames[prevFrame]))
|
||||
@baseMovieClip.gotoAndStop(newFrameIndex)
|
||||
else
|
||||
@baseMovieClip.gotoAndStop(newFrame)
|
||||
translatedFrame = newFrameIndex
|
||||
|
||||
@currentFrame = newFrame
|
||||
@children = []
|
||||
return if translatedFrame is @baseMovieClip.currentFrame
|
||||
|
||||
@baseMovieClip.gotoAndStop(translatedFrame)
|
||||
movieClip.gotoAndStop(newFrame) for movieClip in @childMovieClips
|
||||
@children = []
|
||||
@takeChildrenFromMovieClip()
|
||||
|
||||
takeChildrenFromMovieClip: ->
|
||||
|
|
Loading…
Reference in a new issue