Class: Zyps::BlendAction
- Inherits:
-
TimedAction
- Object
- Action
- TimedAction
- Zyps::BlendAction
- Defined in:
- lib/zyps/actions.rb
Overview
Blend the actor’s color with another color.
Instance Attribute Summary collapse
-
#color ⇒ Object
Color to apply to actor.
Attributes inherited from TimedAction
Instance Method Summary collapse
-
#do(actor, targets) ⇒ Object
Blend the actor’s color with the assigned color.
-
#initialize(rate, color) ⇒ BlendAction
constructor
A new instance of BlendAction.
Methods inherited from TimedAction
Constructor Details
#initialize(rate, color) ⇒ BlendAction
Returns a new instance of BlendAction.
182 183 184 185 |
# File 'lib/zyps/actions.rb', line 182 def initialize(rate, color) super @color = color end |
Instance Attribute Details
#color ⇒ Object
Color to apply to actor.
181 182 183 |
# File 'lib/zyps/actions.rb', line 181 def color @color end |
Instance Method Details
#do(actor, targets) ⇒ Object
Blend the actor’s color with the assigned color.
187 188 189 190 191 |
# File 'lib/zyps/actions.rb', line 187 def do(actor, targets) actor.color.red += (@color.red - actor.color.red) * delta actor.color.green += (@color.green - actor.color.green) * delta actor.color.blue += (@color.blue - actor.color.blue) * delta end |