Class: CheekyDreams::Effects::Crazy

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, new_effect_freq) ⇒ Crazy

Returns a new instance of Crazy.



299
300
301
302
# File 'lib/cheeky-dreams.rb', line 299

def initialize freq, new_effect_freq
	@freq, @new_effect_freq = freq, new_effect_freq
     @count, @fade = 0, nil
end

Instance Method Details

#next(current_colour) ⇒ Object



304
305
306
307
308
309
310
# File 'lib/cheeky-dreams.rb', line 304

def next current_colour
	if @count % @new_effect_freq == 0
		@fade = FadeTo.new([rand(255), rand(255), rand(255)], @new_effect_freq, @freq)
  end
	@count += 1
	[@fade.next(current_colour)[0], @freq]
end