Sha256: 9641ab3a6d5f47831e6df4239fcb7787c6d43eed9efcc472826c1e971eab0d43

Contents?: true

Size: 550 Bytes

Versions: 10

Compression:

Stored size: 550 Bytes

Contents

# Brightness 
# by Rusty Robison. 
# 
# Brightness is the relative lightness or darkness of a color.
# Move the cursor vertically over each bar to alter its brightness. 


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

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

Version data entries

10 entries across 10 versions & 1 rubygems

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