Class: CheekyPi::Animation::Fade
- Defined in:
- lib/cheeky-pi/animation/fade.rb
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
- #animate ⇒ Object
- #handle_complete ⇒ Object
-
#initialize(duration, light, options = {}) ⇒ Fade
constructor
A new instance of Fade.
Methods inherited from Base
#complete, #halt, #percent, #promise, #safe_percent, #sine, #start, #tick, #triangle
Constructor Details
#initialize(duration, light, options = {}) ⇒ Fade
Returns a new instance of Fade.
7 8 9 10 11 12 |
# File 'lib/cheeky-pi/animation/fade.rb', line 7 def initialize(duration, light, ={}) super @to = [:to] @from = [:from] end |
Instance Method Details
#animate ⇒ Object
18 19 20 |
# File 'lib/cheeky-pi/animation/fade.rb', line 18 def animate @light.set(@from.blend(@to, safe_percent)) end |
#handle_complete ⇒ Object
14 15 16 |
# File 'lib/cheeky-pi/animation/fade.rb', line 14 def handle_complete @light.set @to end |