From d76da62ee1e113297a62320a484854f37953148c Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Thu, 19 Dec 2019 16:54:33 -0600 Subject: [PATCH] Update animator pass in from and to objects --- lib/cyberarm_engine/animator.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/cyberarm_engine/animator.rb b/lib/cyberarm_engine/animator.rb index fce7a10..09f63b7 100644 --- a/lib/cyberarm_engine/animator.rb +++ b/lib/cyberarm_engine/animator.rb @@ -1,13 +1,14 @@ module CyberarmEngine class Animator DEFAULT_TWEEN = :linear - def initialize(start_time:, duration:, &block) + def initialize(start_time:, duration:, from:, to:, &block) @start_time, @duration = start_time, duration + @from, @to = from.dup, to.dup @block = block end def update - @block.call(self) if @block + @block.call(self, @from, @to) if @block end def progress @@ -40,7 +41,7 @@ module CyberarmEngine Gosu::Color.from_ahsv(alpha, hue, saturation, value) end - # NOTE: maybe use this for future reference? https://github.com/danro/easing-js/blob/master/easing.js + # NOTE: Use this for future reference? https://github.com/danro/easing-js/blob/master/easing.js def tween_linear(t) t