Sha256: 194dc3eae4b7e4fafc1dc3bc539cd5a17c133df5d46c6b52d6e3b316266bf2de

Contents?: true

Size: 426 Bytes

Versions: 4

Compression:

Stored size: 426 Bytes

Contents

require 'ruby-processing'

class SettingPixelsSketch < Processing::App

  def setup
    # load the pixels array
    load_pixels
    background 0
    # loop through the pixels and set each one to a random greyscale color
    pixels.size.times { |i| pixels[i] = color(rand 255) }
    # update the pixels on screen
    update_pixels
  end


end

SettingPixelsSketch.new :title => "Setting Pixels", :width => 200, :height => 200

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-processing-1.0.1 samples/learning_processing/chapter_15/05_setting_pixels.rb
ruby-processing-1.0.2 samples/learning_processing/chapter_15/05_setting_pixels.rb
ruby-processing-1.0.4 samples/learning_processing/chapter_15/05_setting_pixels.rb
ruby-processing-1.0.3 samples/learning_processing/chapter_15/05_setting_pixels.rb