class WSLight::Set::SunnySet

Creates a set with all random colors

Public Instance Methods

frame() click to toggle source
# File lib/ws_light/set/weather/sunny_set.rb, line 7
def frame
  @set ||= generate_set
end
generate_set() click to toggle source
# File lib/ws_light/set/weather/sunny_set.rb, line 15
def generate_set
  set = []
  position = sun_position
  @full_length.times do |i|
    set << if position.include?(i)
             Color.by_name(:yellow)
           else
             Color.by_name(:blue)
           end
  end
  set
end
pixel(number, _frame = 0) click to toggle source
# File lib/ws_light/set/weather/sunny_set.rb, line 11
def pixel(number, _frame = 0)
  frame[number]
end
sun_position() click to toggle source
# File lib/ws_light/set/weather/sunny_set.rb, line 28
def sun_position
  case rand(4)
  when 0
    10..40
  when 1
    140..170
  when 2
    190..220
  else
    300..330
  end
end