Method: Ray::Turtle#initialize

Defined in:
lib/ray/turtle.rb

#initialize(target) ⇒ Turtle

Returns a new instance of Turtle.

Parameters:

  • target (Ray::Target, Ray::image)

    the object on which the turtle should draw. If target is an image, an ImageTarget will be created.



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ray/turtle.rb', line 16

def initialize(target)
  @target  = target.is_a?(Image) ? Ray::ImageTarget.new(target) : target
  @drawing = true

  @pos = Ray::Vector2[0, 0]
  @angle = 0 # in rad

  @angle_unit = :deg

  @pen_width = 1

  @color = Ray::Color.white
end