Sha256: e0acb3d34fbec2d3b1397a8c64ebc347d3bc13b70c51ce0323c5adab98ca5ec0

Contents?: true

Size: 670 Bytes

Versions: 10

Compression:

Stored size: 670 Bytes

Contents

# Saturation is the strength or purity of the color and represents the 
# amount of gray in proportion to the hue. A "saturated" color is pure 
# and an "unsaturated" color has a large percentage of gray. 
# Move the cursor vertically over each bar to alter its saturation. 

def setup
  size 640, 360
  color_mode HSB, 360
  no_stroke    
  @bar_width = 20
  @saturation = Array.new( width/@bar_width, 0 )    
end

def draw
  i = 0; j = 0; while i <= (width-@bar_width)    
  if (mouseX > i) && (mouseX < (i+@bar_width))
    @saturation[j] = mouseY
  end    
  fill i, @saturation[j], height/1.5
  rect i, 0, @bar_width, height    
  j += 1; i += @bar_width; end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ruby-processing-2.6.3 samples/processing_app/basics/color/saturation.rb
ruby-processing-2.6.2 samples/processing_app/basics/color/saturation.rb
ruby-processing-2.6.1 samples/processing_app/basics/color/saturation.rb
ruby-processing-2.6.0 samples/processing_app/basics/color/saturation.rb
ruby-processing-2.5.1 samples/processing_app/basics/color/saturation.rb
ruby-processing-2.5.0 samples/processing_app/basics/color/saturation.rb
ruby-processing-2.4.4 samples/processing_app/basics/color/saturation.rb
ruby-processing-2.4.3 samples/processing_app/basics/color/saturation.rb
ruby-processing-2.4.2 samples/processing_app/basics/color/saturation.rb
ruby-processing-2.4.1 samples/processing_app/basics/color/saturation.rb