Sha256: ac21f3d06b9f3f30da526ea82b0bbbe6584479a99b7e17ec8d2e46f7f369e8cd
Contents?: true
Size: 718 Bytes
Versions: 4
Compression:
Stored size: 718 Bytes
Contents
require 'ruby-processing' class FillingVariablesWithRandomValues < Processing::App def setup background 255 smooth end def draw # Each time through draw, new random numbers # are picked for a new ellipse. # We're using local variables here, not instance variables, # because we only need them in the draw method. r, g, b, a = random(255), random(255), random(255), random(255) diam = random(20) x, y = random(width), random(height) # Use the values to draw an ellipse no_stroke fill r, g, b, a ellipse x, y, diam, diam end end FillingVariablesWithRandomValues.new :title => "Filling Variables With Random Values", :width => 200, :height => 200
Version data entries
4 entries across 4 versions & 1 rubygems