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.
the Why<br />
Some of the advantages of <strong>SVG</strong> are now discussed, <strong>with</strong> brief explanations:<br />
■■ Client-side graphics Because <strong>SVG</strong> uses client-side graphics, its impact on your web server<br />
is light. In addition to being scalable, <strong>SVG</strong> is dynamic and interactive. A user can interactively<br />
explore the data underlying a picture in novel ways.<br />
■■ Open source (XML) Anyone can view the source code that underlies the graphic. It’s read-<br />
able by humans and looks a lot like HTML.<br />
■■ Accessibility Because the <strong>SVG</strong> source code is written in XML, it is also readable by screen<br />
readers and search engines. While a picture might be worth a thousand words, a megapixel<br />
image is not worth much at all to someone who can’t see it. The ability of <strong>SVG</strong> to bring geometry<br />
to those who cannot see it extends its reach into many domains that pixel-based imagery<br />
just cannot go.<br />
■■ Open standard Because it was created by the W3C (the same organization that brought us<br />
HTML and the web itself), <strong>SVG</strong> is nonproprietary and vendor neutral.<br />
■■ Familiar technologies <strong>SVG</strong> uses technologies already familiar to web programmers: DOM,<br />
JavaScript, CSS, and AJAX. Rather than having to learn entire realms of technology, programming<br />
languages, and terminology to deal <strong>with</strong> the <strong>com</strong>plex and technical area of <strong>com</strong>puter<br />
graphics, designers, programmers, and web professionals can leverage skills learned<br />
elsewhere.<br />
■■ <strong>Web</strong> applications <strong>SVG</strong> is suitable for incorporation <strong>with</strong> HTML5, web-based applications,<br />
and rich Internet applications (RIAs). The last 10 years have seen a great elevation of the status<br />
of the phrase web-based application. Not so many years ago, people in the web <strong>com</strong>munity<br />
used to respond <strong>with</strong> sarcasm or disbelief when someone talked about wanting to create a<br />
web-based application that lived primarily in the browser. A cursory inspection of the history<br />
of HTML5 reveals that the creation of web applications was one of the primary intentions<br />
behind the development of this emerging specification. The incorporation of inline <strong>SVG</strong> into<br />
the HTML5 specification is a great advantage for web developers.<br />
■■ SMIL SMIL is a W3C declarative language supporting multimedia and animation for<br />
nonprogrammers. SMIL is partially incorporated into the <strong>SVG</strong> specification. Those who have<br />
had more than a cursory exposure to programming animation in JavaScript may find themselves<br />
enamored of the ease <strong>with</strong> which certain <strong>com</strong>plex animations can be authored using<br />
<strong>SVG</strong> animation (or SMIL), as well as the ability to update many objects on the screen almost<br />
concurrently. While <strong>SVG</strong> also supports scripted animation through JavaScript, SMIL brings<br />
convenience, parsimony, and elegance to the table.<br />
■<br />
■ The adoption of <strong>SVG</strong> As of 2010, <strong>SVG</strong> is supported natively by the most current versions<br />
of the five major web browsers. Additionally, it can be found in the chip sets aboard several<br />
hundred million mobile phones, <strong>with</strong> major support being offered from Nokia, Ikivo, Sony<br />
CHAPTER 1 <strong>SVG</strong> Basics 3