class SK::Animation
Public Class Methods
new(frames, interval)
click to toggle source
# File lib/shirokuro/standard_components/animations/animation.rb, line 3 def initialize frames, interval @frames = frames @interval = interval @current = 0.0 @current_frame = 0 end
Public Instance Methods
frame()
click to toggle source
# File lib/shirokuro/standard_components/animations/animation.rb, line 10 def frame @frames[@current_frame] end
reset()
click to toggle source
# File lib/shirokuro/standard_components/animations/animation.rb, line 14 def reset @current = 0.0 @current_frame = 0 end
update(dt)
click to toggle source
# File lib/shirokuro/standard_components/animations/animation.rb, line 19 def update dt @current += dt if @current > @interval @current = 0.0 @current_frame += 1 if @current_frame > @frames.size - 1 reset end end end