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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Here’s how it’s done:<br />

■■ The two swirly gradients <strong>SVG</strong> has two primary sorts of gradients: linear and radial. The<br />

radial gradient allows for a special type called a reflected gradient. In this case, two identical<br />

ellipses are located one atop the other. Both have alternating bands of opacity and<br />

transparency coinciding <strong>with</strong> their alternating colors, which allows us to see through to the<br />

background.<br />

■■ The animation The center and focal points of the reflected gradients are then independent-<br />

ly animated using SMIL animation.<br />

example 8: Clock <strong>with</strong> Impressionist tinge<br />

There are lots of <strong>SVG</strong> clocks on the <strong>Web</strong>. Displaying time is a medium of expression ripe <strong>with</strong> opportunity,<br />

it seems. This particular one is probably not the most artful, elegant, appealing, fanciful,<br />

decorative, or marketable version available, but its ability to do what it does <strong>with</strong> only 79 lines of code<br />

(about half JavaScript and half <strong>SVG</strong>) may help to illustrate the ease and brevity <strong>with</strong> which you can<br />

achieve rich effects. You can find an animated version of this (for browsers that support SMIL animation)<br />

at http://srufaculty.sru.edu/david.dailey/svg/ballclock.svg.<br />

14 <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!