25.02.2013 Views

Peter Lubbers - Pro HTML 5 Programming

Pro HTML 5 Programming

Pro HTML 5 Programming

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.

Figure 2-17. Background pattern-filled text<br />

Applying Shadows<br />

CHAPTER 2 ■ USING THE <strong>HTML</strong>5 CANVAS API<br />

Finally, we will use the built-in canvas shadow API to add a blurred shadow effect to our new text<br />

display. Like many graphical effects, shadows are best applied in moderation, even though the <strong>HTML</strong>5<br />

Canvas API allows you to apply shadows to any operation we have already covered.<br />

Once again, shadows are controlled by a few global context properties, as shown in Table 2-4.<br />

Table 2-4. Shadow properties<br />

<strong>Pro</strong>perty Values Note<br />

shadowColor Any CSS color Can include an alpha component<br />

shadowOffsetX Pixel count Positive values move shadow to the right, negative left<br />

shadowOffsetY Pixel count Positive values move shadow down, negative up<br />

shadowBlur Gaussian blur Higher values cause blurrier shadow edges<br />

55

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

Saved successfully!

Ooh no, something went wrong!