mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 21:22:33 +00:00
Update animator pass in from and to objects
This commit is contained in:
@@ -1,13 +1,14 @@
|
|||||||
module CyberarmEngine
|
module CyberarmEngine
|
||||||
class Animator
|
class Animator
|
||||||
DEFAULT_TWEEN = :linear
|
DEFAULT_TWEEN = :linear
|
||||||
def initialize(start_time:, duration:, &block)
|
def initialize(start_time:, duration:, from:, to:, &block)
|
||||||
@start_time, @duration = start_time, duration
|
@start_time, @duration = start_time, duration
|
||||||
|
@from, @to = from.dup, to.dup
|
||||||
@block = block
|
@block = block
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@block.call(self) if @block
|
@block.call(self, @from, @to) if @block
|
||||||
end
|
end
|
||||||
|
|
||||||
def progress
|
def progress
|
||||||
@@ -40,7 +41,7 @@ module CyberarmEngine
|
|||||||
Gosu::Color.from_ahsv(alpha, hue, saturation, value)
|
Gosu::Color.from_ahsv(alpha, hue, saturation, value)
|
||||||
end
|
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)
|
def tween_linear(t)
|
||||||
t
|
t
|
||||||
|
|||||||
Reference in New Issue
Block a user