Drawing Ovals

You use the oval method to draw an oval. The signature of this method is as follows.

oval(x, y, radius, yRadius)

Draws an oval at the origin (x, y) with a radius radius. If the yRadius is not present, it is translated as the same as the x radius, and the result is a circle.

For instance, the code in Listing 10.4 shows two ovals.

Listing 10.4. Drawing ovals
<canvas height="200">
    <drawview height="200" width="600">
        <method event="oninit">
            this.oval(100, 100, 75, 30);
            this.oval(300, 100, 75);
            this.stroke();
        </method>
    </drawview>
</canvas>

You can use this URL to test and run the application.

http://localhost:8080/lps-4.0.x/app10/ovalTest1.lzx

Figure 10.4 shows the ovals drawn.

Figure 10.4. Drawing ovals


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset