Sha256: 998bd65839598f9b37d3f578ebde1afc0c52b3dad4cc865ddf0d8f1aff5e9fe2

Contents?: true

Size: 600 Bytes

Versions: 9

Compression:

Stored size: 600 Bytes

Contents

# Hue is the color reflected from or transmitted through an object 
# and is typically referred to as the name of the color (red, blue, yellow, etc.) 
# Move the cursor vertically over each bar to alter its hue. 


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

def draw
  (width/@bar_width).times do |i|
    n = i * @bar_width
    range = (n .. n + @bar_width)
    @hue[i] = mouse_y if range.include?(mouse_x)
    fill @hue[i], height/1.2, height/1.2
    rect n, 0, @bar_width, height
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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