04.07.2013 Views

Building Web Applications with SVG - Cdn.oreilly.com

Building Web Applications with SVG - Cdn.oreilly.com

Building Web Applications with SVG - Cdn.oreilly.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The file is also visible at http://cs.sru.edu/~ddailey/svg/simplest.svg should you have any problems<br />

seeing the file you’ve created.<br />

You’ll see information about more advanced editing environments at the end of this chapter, and<br />

you’ll of course see many more examples of <strong>SVG</strong> code throughout the rest of the book.<br />

Thirteen Examples That Show the Capabilities of <strong>SVG</strong><br />

To fully appreciate the power of <strong>SVG</strong>, <strong>com</strong>plete <strong>with</strong> its interactivity and animation capabilities, I<br />

encourage you to take a look at the tutorial page on this book’s website (http://cs.sru.edu/~svg), which<br />

contains links to interesting examples, and also to explore and read the examples illustrated and<br />

briefly discussed below.<br />

Note We haven’t yet defined the terms for the effects described below, but we’ll make<br />

them clear later on. At this point, we simply want to ensure that you have some idea of<br />

what <strong>SVG</strong> can ac<strong>com</strong>plish before you begin working <strong>with</strong> it. How else to know the lay of<br />

the land?<br />

example 1: Dynamic random Landscape Drawn <strong>with</strong><br />

JavaScript and <strong>SVG</strong><br />

The scenery here, inspired by one author’s frequent drives from his homeland in New Mexico to his<br />

graduate school in Colorado, shows the effect of motion parallax on the various mountain ranges<br />

leading from the foothills to the Continental Divide. As the vantage point moves continually northward<br />

toward the badlands of Wyoming, a slightly impressionistic hot-air balloon follows. Its vertical<br />

position, speed, and wind deformation change somewhat randomly as we move. The various layers<br />

of mountains recede behind us to the left, <strong>with</strong> the taller peaks remaining visible longer. Owing<br />

to the use of random elements, no two landscapes will ever be the same (ignoring the infinitesimal<br />

probability of extreme coincidence). The example can be seen at (http://srufaculty.sru.edu/david<br />

.dailey/svg/balloon.svg).<br />

6 <strong>Building</strong> <strong>Web</strong> <strong>Applications</strong> <strong>with</strong> <strong>SVG</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!