Guest User

Untitled

a guest
May 19th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class AnimationFrame
  2.   constructor : (@image, @holdFrames = 0) ->
  3.  
  4. class Animation
  5.   currentFrame : 1
  6.   constructor : (@frames) ->
  7.  
  8.   yield : () ->
  9.     currentFrame = @currentFrame
  10.     frameCount = 0
  11.     totalFrames = 0
  12.     yield = undefined
  13.     _.each @frames, (frame, key) ->
  14.       lastFrameCount = frameCount
  15.       frameCount += frame.holdFrames
  16.       if currentFrame > lastFrameCount and currentFrame <= frameCount
  17.         yield = frame
  18.     if currentFrame >= frameCount
  19.       @currentFrame = 1
  20.     else
  21.       @currentFrame++
  22.     return yield
Add Comment
Please, Sign In to add comment