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.
<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.