Sha256: 66d68824d73fc47a415ec2a306dedca3b373eca0d904500eacc7ccd1c1367ee4

Contents?: true

Size: 903 Bytes

Versions: 5

Compression:

Stored size: 903 Bytes

Contents

require 'cf3'

def setup_the_spiral
  @spiral= ContextFree.define do
    ############ Begin defining custom terminal, an isoceles triangle     
    class << self     
      define_method(:isoceles) do |some_options| # isoceles triangle
        size, options = *self.get_shape_values(some_options)
        rot = options[:rotation]
        rotate(rot) if rot 
        $app.triangle(-0.5 * size, -0.5 * size, -0.5 * size, 0.5 * size, 0.5 * size, 0.5 * size)
        rotate(-rot) if rot
      end
    end
    ########### End definition of custom terminal 'isoceles'
    shape :spiral do
      isoceles brightness: -1, rotation: 90
      spiral rotation: 135, size: 1/sqrt(2), x: 1/sqrt(2)
    end
  end
end

def setup
  size 800, 500
  setup_the_spiral
  draw_it
end

def draw
  # Do nothing.
end

def draw_it
  background 255
  @spiral.render :spiral, size: height, start_x: width/3, start_y: height/2
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cf3-0.0.5 samples/isosceles.rb
cf3-0.0.4 samples/isosceles.rb
cf3-0.0.3 samples/isosceles.rb
cf3-0.0.2 samples/isosceles.rb
cf3-0.0.1 samples/isosceles.rb