Sha256: 7e638fe81b884e8b2c4152248fdf7594bfdf8846dff0d5de394cac1b67991ca2
Contents?: true
Size: 957 Bytes
Versions: 2
Compression:
Stored size: 957 Bytes
Contents
require 'ws_light/color' module WSLight module Set # Base set with one color class ColorSet DEFAULT_LENGTH = 160 DEFAULT_TYPE = :double attr_accessor :type, :length, :color, :full_length 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 def frame_data frame.collect{|color| color.to_a}.flatten end def frame length = type == :double ? @length * 2 : @length set = [] length.times do set << @color end set end def next_frame # reimplement if necessary, please :) end def pixel(_number, _frame = 0) @color end def init # do some initializing stuff here end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ws_light-0.3.0 | lib/ws_light/set/color_set.rb |
ws_light-0.2.0 | lib/ws_light/set/color_set.rb |