Sha256: 5f6602e118e728e44add79b11bed32b69453e90a742e1a2982d10bbce11c4fd2

Contents?: true

Size: 557 Bytes

Versions: 4

Compression:

Stored size: 557 Bytes

Contents

require 'ruby-processing'

class EllipseWithVariables < Processing::App

  def setup
    # Initialize your variables (you don't have to declare 'em)
    @r, @g, @b, @a = 100, 150, 200, 200
    @x, @y = 100, 100
    @diam = 20
    
    background 255
    smooth
  end
  
  def draw
    # Use the variables to draw an ellipse
    stroke 0
    fill @r, @g, @b, @a # Remember, the fourth argument for a color means opacity.
    ellipse @x, @y, @diam, @diam
  end
  
end

EllipseWithVariables.new :title => "Ellipse With Variables", :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_04/6_ellipse_with_variables.rb
ruby-processing-1.0.2 samples/learning_processing/chapter_04/6_ellipse_with_variables.rb
ruby-processing-1.0.3 samples/learning_processing/chapter_04/6_ellipse_with_variables.rb
ruby-processing-1.0.4 samples/learning_processing/chapter_04/6_ellipse_with_variables.rb