Sha256: 45c9593251f01d5a986606c55381f6c2b109e6e3760ab967cf645d114dae7668

Contents?: true

Size: 915 Bytes

Versions: 4

Compression:

Stored size: 915 Bytes

Contents

require 'ruby-processing'

class ZoogAsDynamicSketchWithVariation < Processing::App

  def setup
    smooth
  end
  
  def draw
    background 255 # Draw a white background
    
    # Set ellipses and rects to CENTER mode
    ellipse_mode CENTER 
    rect_mode CENTER  

    # Draw Zoog's body
    stroke 0 
    fill 150 
    # Zoog's body is drawn at the location (mouse_x, mouse_y)
    rect mouse_x, mouse_y, 20, 100 

    # Draw Zoog's head
    stroke 0
    fill 255
    # Zoog's head is drawn above the body at the location (mouse_x, mouse_y - 30)
    ellipse mouse_x, mouse_y - 30, 60, 60  

    # Draw Zoog's eyes
    fill 0  
    ellipse 81, 70, 16, 32  
    ellipse 119, 70, 16, 32 

    # Draw Zoog's legs
    stroke 0 
    line 90, 150, 80, 160 
    line 110, 150, 120, 160
  end
  
end

ZoogAsDynamicSketchWithVariation.new :title => "Zoog As Dynamic Sketch With Variation", :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_03/3_zoog_as_dynamic_sketch_with_variation.rb
ruby-processing-1.0.2 samples/learning_processing/chapter_03/3_zoog_as_dynamic_sketch_with_variation.rb
ruby-processing-1.0.4 samples/learning_processing/chapter_03/3_zoog_as_dynamic_sketch_with_variation.rb
ruby-processing-1.0.3 samples/learning_processing/chapter_03/3_zoog_as_dynamic_sketch_with_variation.rb