Class: CheekyDreams::Effects::Throb2

Inherits:
Effect
  • Object
show all
Defined in:
lib/cheeky-dreams.rb

Constant Summary

Constants included from CheekyDreams

COLOURS

Instance Method Summary collapse

Methods included from CheekyDreams

#ansi_driver, #audit_to, #crazy, #cycle, #dev_null, #fade, #fade_to, #find_dream_cheeky_usb_device, #forward, #func, #light_show, #max, #off, #position_between, #rgb, #rgb_between, #sleep_until, #solid, #stdio_audit, #stdout_driver, #suppress_duplicates, #throb, #throbbing

Constructor Details

#initialize(freq, amplitude, centre) ⇒ Throb2

Returns a new instance of Throb2.



254
255
256
# File 'lib/cheeky-dreams.rb', line 254

def initialize freq, amplitude, centre
  @freq, @amplitude, @centre, @count = freq, amplitude, centre, 1
end

Instance Method Details

#next(current_colour) ⇒ Object



258
259
260
261
262
# File 'lib/cheeky-dreams.rb', line 258

def next current_colour
  x = @freq * (@count += 1)
  v = sin(x) * @amplitude + @centre
  [[v, 0, 0], @freq]
end