Module: Hue::Animations::Candle
- Included in:
- Bulb
- Defined in:
- lib/hue/animations/candle.rb
Instance Method Summary collapse
Instance Method Details
#candle(repeat = 15) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/hue/animations/candle.rb', line 7 def candle(repeat = 15) # 0-65536 for hue, 182 per deg. Ideal 30-60 deg (5460-10920) stash! on if off? repeat.times do hue = ((rand * 3460) + 5460).to_i sat = rand(64) + 170 bri = rand(32) + 16 delay = (rand * 0.35) + (@delay ||= 0) update(hue: hue, sat: sat, bri: bri, transitiontime: (delay * 10).to_i) sleep delay end restore! end |