XML technologies / SVG / Using complex graphic elements and formatting / Using paths correctly / Creating Bézier curves / The C command
(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)
The C command draws cubic Bézier curves. Its syntax is:
C x1 y1 x2 y2 x y
Here, x and y specify the line’s endpoint. The point x1/y1 sets the control point at the line’s start, and x2/y2 the control point at its end.
The two control points determine the curve’s bend. They define imaginary guide lines, always running from the control points to the line’s start or end.
The instruction
<path d="M100 100 C150 0 250 200 350 100" style="stroke:rgb(0,0,0);stroke-width:3;fill:none"/>draws the Bézier curve shown in the following figure, which also displays guide lines and control points for clarity.
Figure: Bézier curve created with the C command.
Move the control points to change the curve’s shape. The following figure shows the result of moving the right control point farther right and the left one farther left. The old gray line and new black line are superimposed to clarify the changes.
Figure: Changing the Bézier curve by moving its control points.
Copyright © verlag moderne industrie GmbH 2001
You may print the online version for your private use.
Otherwise, this chapter from “Das Einsteigerseminar SVG — Webgrafiken mit XML” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
verlag moderne industrie GmbH, Justus-von-Liebig-Straße 1, D-86899 Landsberg/Lech, fon ++49 (0) 81 91 / 125 – 0, leserservice(at)mi-verlag.de
back to top