Method: Ray::Animation#progression

Defined in:
lib/ray/animation.rb

#progressionFloat?

Returns The progression of the animation, between 0 and 1. Nil if the animation isn’t running.

Returns:

  • (Float, nil)

    The progression of the animation, between 0 and 1. Nil if the animation isn’t running.



201
202
203
204
205
206
207
208
209
210
# File 'lib/ray/animation.rb', line 201

def progression
  if running?
    if @duration.zero?
      1.0
    else
      ret = (Time.now - @start_time) / duration
      ret > 1 ? 1.0 : ret
    end
  end
end