Skip to content

Learn: Draw Shapes

Julia Ogris edited this page Aug 1, 2023 · 10 revisions

Evy has many commands that can be used to make drawings. We will start by creating shapes with move, line, rect, and circle.

move

The move command sets the position of the drawing pen, and the line command draws a line from the current position of the pen to the specified coordinates. For example:

move 20 40
line 50 50
canvas with line

We use the move command to set the pen to position 20 40. Then, we use the line command to draw a line to position 50 50.

Note, this and all following images are created with evy code.

line

The line command draws a line from the current position of the pen to the specified coordinates. The current position of the pen is updated to new coordinates. Here is an example of how to draw a triangle.

move 20 40
line 50 80
line 80 40
line 20 40
canvas with triangle and grid

rect

The rect command draws a rectangle with the given width and height at the pen's current position. If the pen is currently at position 50 50, and you type rect 10 20, the program will draw a rectangle with width 10 and height 20, and then move the pen to position 60 70.

move 50 50
rect 10 20
rect 30 10
canvas with rectangles and grid

circle

The circle command draws a circle with the given radius. The center of the circle is the pen's current position, and the pen does not move.

For example, if the pen is currently at position 50 50, and you type circle 10, the program will draw a circle with radius 10, centered at position 50 50. The pen will still be at position 50 50 after the circle is drawn.

move 50 50
circle 10
canvas with rectangles and grid

Summary

  • move x y sets the position of the drawing pen.
  • line x y draws a line from the current position of the pen to the specified coordinates x y.
  • rect w h draws a rectangle with the specified width w and height h.
  • circle r draws a circle at the current position of the pen with the given radius r.