lib/cyberarm_engine/animator.rb in cyberarm_engine-0.14.0 vs lib/cyberarm_engine/animator.rb in cyberarm_engine-0.15.0

- old
+ new

@@ -1,11 +1,13 @@ module CyberarmEngine class Animator DEFAULT_TWEEN = :linear def initialize(start_time:, duration:, from:, to:, &block) - @start_time, @duration = start_time, duration - @from, @to = from.dup, to.dup + @start_time = start_time + @duration = duration + @from = from.dup + @to = to.dup @block = block end def update @block.call(self, @from, @to) if @block @@ -21,11 +23,11 @@ def transition(from, to, tween = DEFAULT_TWEEN) from + (to - from) * send("tween_#{tween}", progress) end - def color_transition(from, to, tween = DEFAULT_TWEEN) + def color_transition(from, to, _tween = DEFAULT_TWEEN) r = transition(from.red, to.red) g = transition(from.green, to.green) b = transition(from.blue, to.blue) a = transition(from.alpha, to.alpha) @@ -49,6 +51,6 @@ def tween_sine(t) Math.sin(t) * t end end -end \ No newline at end of file +end