From the course: Learning HTML Canvas

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Drawing shadows

Drawing shadows

From the course: Learning HTML Canvas

Start my 1-month free trial

Drawing shadows

- [Instructor] So far, we've learned how to to use the basic canvas drawing operations. In this chapter, we're going to take a look at using some of the more complex canvas drawing techniques, starting with creating shadows. The canvas drawing context provides four properties that you can use to control how to draw shadows on the canvas. And all the drawing operations that take place on the canvas are affected by these shadow attributes. This includes paths, images, text, lines, and so on. When you draw shadows, they can be colored, they can be offset in both the x and the y direction and they can have a blur value. The shadowColor property specifies the color to use when drawing the shadow. The offset X and offset Y properties are pretty self-explanatory, they control the horizontal and vertical offsets to the shadow. They both default to zero. And the shadowBlur property controls the level of blurring. And that value does not correspond directly to a pixel value, it just has to be…

Contents