Class: DreamCheeky::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/dreamcheeky/notifier/animate.rb

Instance Method Summary collapse

Instance Method Details

#breathe(colour, rate) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dreamcheeky/notifier/animate.rb', line 6

def breathe(colour, rate)
  @thread = Thread.new {
    EM.run {
      n=1
      direction=1
      EM::PeriodicTimer.new(rate/20.0) {
        self.colour colour.adjust_brightness (-n*10)
        direction = -direction if n == 0 || n == 10
        n += direction
      }
    }
  }
end