class WSLight::Set::ColorSet
Base set with one color
Constants
- DEFAULT_LENGTH
- DEFAULT_TYPE
Attributes
color[RW]
full_length[RW]
length[RW]
type[RW]
Public Class Methods
new(length = DEFAULT_LENGTH, type = DEFAULT_TYPE)
click to toggle source
# File lib/ws_light/set/color_set.rb, line 12 def initialize(length = DEFAULT_LENGTH, type = DEFAULT_TYPE) @length = length @type = type @full_length = (@type == :double ? @length * 2 : @length) @color = Color.random @frame_count = 0 init end
Public Instance Methods
frame()
click to toggle source
# File lib/ws_light/set/color_set.rb, line 25 def frame length = type == :double ? @length * 2 : @length set = [] length.times do set << @color end set end
frame_data()
click to toggle source
# File lib/ws_light/set/color_set.rb, line 21 def frame_data frame.collect(&:to_a).flatten end
init()
click to toggle source
# File lib/ws_light/set/color_set.rb, line 42 def init # do some initializing stuff here end
next_frame()
click to toggle source
# File lib/ws_light/set/color_set.rb, line 34 def next_frame # reimplement if necessary, please :) end
pixel(_number, _frame = 0)
click to toggle source
# File lib/ws_light/set/color_set.rb, line 38 def pixel(_number, _frame = 0) @color end