Please enable JavaScript to view this site.

ESL Documentation

As ESL executes each drawing statement in a pattern, it moves the graphics cursor and the text cursor of the object that contains the pattern reference. The cursors are moved exactly as they would be if the drawing statements of the pattern were specified in the object definition. In the following example:

 

pattern Cubes is

    box 200 200        # Outermost box

    move 10 10

    red box 180 180    # Middle box

    move 10 10

    green box 160 160  # Innermost box

    move 80 80         # Move to center

 

the pattern, Cubes, consists of six drawing statements that describe a set of three nested boxes, as shown below:

 

_img295

 

The final drawing statement positions the text cursor and the graphics cursor in the center of the innermost box. The key defined below references this pattern.

 

key Blue at position 100 200

    blue pattern Cubes

    text center "Blue Box"

 

When ESL draws the Blue key on the display, it begins the pattern Cubes at position 100 200. The position at which ESL begins to draw a pattern is called the reference point of the pattern.

 

After this pattern has been executed, the cursors are in the center of the innermost box. The final drawing statement centers the text string, "Blue Box", horizontally and vertically.

 

The pattern's reference point is the position of the graphics cursor at the time that the pattern is referenced. Each pattern reference establishes a reference point for that pattern within that object; for example:

 

key First at position 300 150

    move 100 -50

    pattern Star

 

This object definition establishes the reference point of the pattern, Star, as position 100 -50 in the coordinate system of the key First, because that is the position of the graphics cursor at the time the pattern is referenced. In the object definition below, the reference point of the pattern is position 50 0 in the coordinate system of the key Second.

 

key Second at position 200 200

    draw 50 100, 0 -100

    pattern Star

 

The reference point of a pattern is also used when the pattern is scaled or rotated. Pattern scaling and rotation are described below.