mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 13:12:34 +00:00
Update animator pass in from and to objects
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user