Sha256: e8ce7b77df637a9355a9aa358c33ec55cb297cc863832110e50baed96718aedf

Contents?: true

Size: 257 Bytes

Versions: 6

Compression:

Stored size: 257 Bytes

Contents

module Tween
  def self.move_towards(from:, to:, speed:)
    direction = to - from
    step = [direction.length, speed * Global.frame_time].min

    return to if step.zero?

    direction = direction.normalize
    return from + (direction * step)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fantasy-0.1.13 lib/fantasy/tween.rb
fantasy-0.1.11 lib/fantasy/tween.rb
fantasy-0.1.9 lib/fantasy/tween.rb
fantasy-0.1.7 lib/fantasy/tween.rb
fantasy-0.1.5.1 lib/fantasy/tween.rb
fantasy-0.1.5 lib/fantasy/tween.rb