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.

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

■■ Clipping an image by a shape The leftmost image is defined by an element. Its<br />

attribute clip-path=“url(#CPST)” references the element , which itself<br />

contains a star-shaped element.<br />

■<br />

■ Clipping a clip path This is done in either of two ways in this example: First, the <br />

element to which a clip path has been applied is reused <strong>with</strong> a element. The <br />

element then has another clip path applied to it (which happens to consist of the lavender<br />

rectangle). The two clip paths intersect as would be expected. The other approach is to build<br />

a that has its own clip-path attribute defined. This works in Internet Explorer 9,<br />

Opera, and Internet Explorer <strong>with</strong> ASV, as you would expect, and is the same regardless of<br />

whether the secondary clip path is applied to the parent or the elements <strong>with</strong>in it.<br />

The other browsers show a variety of idiosyncratic responses to this approach.<br />

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