Drawing Quadratic Curves

You draw quadratic curves by using the quadraticCurveTo method defined in the LzDrawView class. The code in Listing 10.5 shows how to achieve this.

Listing 10.5. Drawing quadratic curves
<canvas height="200">
    <drawview height="200" width="600">
        <method event="oninit">
            this.moveTo(200,100);
            this.quadraticCurveTo(40, 200, 100, 50);
            this.moveTo(400, 100);
            this.quadraticCurveTo(40, 200, 300, 50);
            this.stroke()
        </method>
    </drawview>
</canvas>

To test the code in Listing 10.5, use this URL:

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

Figure 10.5 shows the curves.

Figure 10.5. Drawing quadratic curves


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

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