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