Class: Ruby2D::Color::Set
- Inherits:
-
Object
- Object
- Ruby2D::Color::Set
- Includes:
- Enumerable
- Defined in:
- lib/ruby2d/color.rb
Overview
Color::Set represents an array of colors.
Instance Method Summary collapse
- #[](index) ⇒ Object
- #each(&block) ⇒ Object
- #first ⇒ Object
-
#initialize(colors) ⇒ Set
constructor
A new instance of Set.
- #last ⇒ Object
- #length ⇒ Object (also: #count)
- #opacity ⇒ Object
- #opacity=(opacity) ⇒ Object
Constructor Details
Instance Method Details
#[](index) ⇒ Object
18 19 20 |
# File 'lib/ruby2d/color.rb', line 18 def [](index) @colors[index] end |
#each(&block) ⇒ Object
28 29 30 |
# File 'lib/ruby2d/color.rb', line 28 def each(&block) @colors.each(&block) end |
#first ⇒ Object
32 33 34 |
# File 'lib/ruby2d/color.rb', line 32 def first @colors.first end |
#last ⇒ Object
36 37 38 |
# File 'lib/ruby2d/color.rb', line 36 def last @colors.last end |
#length ⇒ Object Also known as: count
22 23 24 |
# File 'lib/ruby2d/color.rb', line 22 def length @colors.length end |
#opacity ⇒ Object
40 41 42 |
# File 'lib/ruby2d/color.rb', line 40 def opacity @colors.first.opacity end |
#opacity=(opacity) ⇒ Object
44 45 46 47 48 |
# File 'lib/ruby2d/color.rb', line 44 def opacity=(opacity) @colors.each do |color| color.opacity = opacity end end |