Sha256: d9e740125e0caa0057a78e16f01ec76ebabbb97069ce89e271ee09238bb4ccb8
Contents?: true
Size: 961 Bytes
Versions: 4
Compression:
Stored size: 961 Bytes
Contents
require 'ruby-processing' class ManyVariables < Processing::App def setup # We've got 8 variables now! They're all Floats. @circle_x, @circle_y = 0.0, 0.0 @circle_w, @circle_h = 50.0, 100.0 @circle_stroke = 255.0 @circle_fill = 0.0 @background_color = 255.0 @change = 0.5 smooth end def draw # Draw the background and the ellipse. # Variables are used for everything: # background, stroke, fill, location and size. background @background_color stroke @circle_stroke fill @circle_fill ellipse @circle_x, @circle_y, @circle_w, @circle_h # Change the values of all variables. # The variable change is used to update the others. @circle_x += @change @circle_y += @change @circle_w += @change @circle_h -= @change @circle_stroke -= @change @circle_fill += @change end end ManyVariables.new :title => "Many Variables", :width => 200, :height => 200
Version data entries
4 entries across 4 versions & 1 rubygems