Sha256: b0f8629b79ac6f0b78d55f12d40f8ad4367e468fbe5c6356a6bd072d9eb5b6ce

Contents?: true

Size: 609 Bytes

Versions: 2

Compression:

Stored size: 609 Bytes

Contents

# Recursion2

class Recursion2 < Processing::App

  def setup
    
    size 200, 200
    
    no_stroke
    smooth
    
    draw_circle 100, 100, 80, 8
  end
  
  def draw_circle ( x, y, radius, level )
  
  	tt = 126 * level / 6.0
  	fill tt, 153
  	
  	ellipse x, y, radius*2, radius*2
  	
  	if level > 1
  	
  		level = level - 1
  		num = random( 2, 6 ).to_i
  		
  		0.upto( num-1 ) do |i|
  			
  			a = random 0, TWO_PI
  			nx = x + cos( a ) * 6.0 * level
  			ny = y + sin( a ) * 6.0 * level
  			draw_circle nx, ny, radius/2, level
  		end
  	end
  end
  
end

Recursion2.new :title => "Recursion2"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-processing-1.0.11 samples/processing_app/basics/structure/recursion2.rb
ruby-processing-1.0.10.1 samples/processing_app/basics/structure/recursion2.rb