Building Web Applications with SVG - Cdn.oreilly.com
Building Web Applications with SVG - Cdn.oreilly.com
Building Web Applications with SVG - Cdn.oreilly.com
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Modifying your code and experimenting<br />
In this exercise, you’ll experiment <strong>with</strong> the circle you drew in the previous exercise by changing its<br />
location, size, and color, rebuilding it so that only its outer boundary remains black.<br />
1. Move the circle to the center of the screen. You do this by setting the x and y coordinates of<br />
the center of the circle (cx and cy, respectively) to 50 percent, which is measured relative to the<br />
width and height of the browser window.<br />
<br />
<br />
<br />
2. Increase the radius and set it as a fixed proportion of the browser’s width.<br />
Note A geometric attribute, such as cx, cy, or r in this case, can be set as either a<br />
proportional value (relative to window size) or an absolute value (pixels, by default).<br />
<br />
<br />
<br />
3. Change its color. You can do this by setting the fill attribute to a named color, or in a variety of<br />
other ways (e.g., using CSS or HTML hexadecimal values, RGB values, or HSB values).<br />
<br />
<br />
<br />
24 <strong>Building</strong> <strong>Web</strong> <strong>Applications</strong> <strong>with</strong> <strong>SVG</strong>