Class: Ruby2D::Color::Set

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby2d/color.rb

Overview

Color::Set represents an array of colors

Instance Method Summary collapse

Constructor Details

#initialize(colors) ⇒ Set

Returns a new instance of Set.



7
8
9
# File 'lib/ruby2d/color.rb', line 7

def initialize(colors)
  @colors = colors.map{|c| Color.new(c)}
end

Instance Method Details

#[](i) ⇒ Object



11
12
13
# File 'lib/ruby2d/color.rb', line 11

def [](i)
  @colors[i]
end

#lengthObject



15
16
17
# File 'lib/ruby2d/color.rb', line 15

def length
  @colors.length
end

#opacityObject



19
# File 'lib/ruby2d/color.rb', line 19

def opacity; @colors[0].opacity end

#opacity=(opacity) ⇒ Object



21
22
23
24
25
# File 'lib/ruby2d/color.rb', line 21

def opacity=(opacity)
  @colors.each do |color|
    color.opacity = opacity
  end
end