Sha256: b55ea627797899a420568461923814bec6670df43efdc2fd814ca6a7f647e14b

Contents?: true

Size: 649 Bytes

Versions: 10

Compression:

Stored size: 649 Bytes

Contents

# Variables are used for storing values. In this example, changing 
# the values of variables @one and @two significantly changes the composition. 

load_library :control_panel
attr_reader :panel
def setup
  size 200, 200  
  stroke 153    
  @one = 20 # Change these with the sliders
  @two = 50    
  control_panel do |c|
    c.slider :one, -20..100
    c.slider :two, -20..100
    @panel = c
  end  
end


def draw
  panel.set_visible(true)
  background 0    
  c = @one * 8
  d = @one * 9
  e = @two - @one
  f = @two * 2
  g = f  + e
  
  line @one, f, @two,  g
  line @two, e, @two,  g
  line @two, e, d,     c
  line @one, e, d-e,   c
end



Version data entries

10 entries across 10 versions & 1 rubygems

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