Sha256: 98dd1a37072870e5ca766d413a0e5921c9691558c4ae2dff03820bcf1559a4dd

Contents?: true

Size: 469 Bytes

Versions: 1

Compression:

Stored size: 469 Bytes

Contents

#
# Koch Curve
# by Daniel Shiffman.
# 
# Renders a simple fractal, the Koch snowflake. 
# Each recursive level is drawn in sequence. 
#

load_libraries :koch, :vecmath

attr_reader :k

def setup
  size(640, 360)
  frame_rate(1)  # Animate slowly
  @k = KochFractal.new(width, height)
end

def draw
  background(0)
  # Draws the snowflake!
  k.render
  # Iterate
  k.next_level
  # Let's not do it more than 5 times. . .
  if (k.get_count > 5) 
    k.restart
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-processing-2.4.4 samples/processing_app/topics/lsystems/koch.rb