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 basic shape First, a quadrilateral is drawn <strong>with</strong> <strong>SVG</strong> using a element.<br />

■■ Replicating from left to right It is then replicated by placing a element inside<br />

the . The element instructs the quadrilateral’s shape and position to be<br />

gradually duplicated from left to right. Additionally, the gradient applied to the quadrilateral<br />

is retrieved, and one of its defining color bands (or stops) is gradually changed from red to<br />

green, and finally to purple (<strong>with</strong> the color values of that gradient being modified as well).<br />

■■ Replicating vertically The results of the first replication are viewed as part of a group that<br />

is then replicated upward, <strong>with</strong> its scale being modified as it is cloned.<br />

example 12: triangular tiling<br />

While <strong>SVG</strong> has a element, which allows the creation of repeated rectangular tiles, if you<br />

wish to use nonrectangular tilings or to individually modify the elements from one part of a pattern<br />

to another, then script may be the way to go. The juxtaposition of opacity, rotation, gradients,<br />

and triangles is something easily done in <strong>SVG</strong>. The rotation of the inner triangles creates a bivalent<br />

appearance of either clover leaves or honey<strong>com</strong>bs, depending on orientation. You can see this example<br />

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

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