Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AnimationFrame
- constructor : (@image, @holdFrames = 0) ->
- class Animation
- currentFrame : 1
- constructor : (@frames) ->
- yield : () ->
- currentFrame = @currentFrame
- frameCount = 0
- totalFrames = 0
- yield = undefined
- _.each @frames, (frame, key) ->
- lastFrameCount = frameCount
- frameCount += frame.holdFrames
- if currentFrame > lastFrameCount and currentFrame <= frameCount
- yield = frame
- if currentFrame >= frameCount
- @currentFrame = 1
- else
- @currentFrame++
- return yield
Add Comment
Please, Sign In to add comment