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.

Compositing and globalAlpha

Compositing and globalAlpha

From the course: Learning HTML Canvas

Start my 1-month free trial

Compositing and globalAlpha

- [Instructor] In addition to transforms, the canvas provides different compositing methods and a global alpha setting. And that's the opacity setting that affects all of the drawing operations that happen on the canvas. The global alpha is a value from zero to one, where one is full opacity, and zero is fully transparent. And we'll see more examples of that in a moment. There's also a setting for the default compositing method. And that affects how new content that is drawn onto the canvas surface is affected by the content that's already there. So there are 12 different compositing methods, and I've listed them all here. The first is called source-over, and this is the default compositing method for the canvas. Basically what that means is every time you draw something new, it gets drawn on top of what's already there, which is pretty much the behavior you would expect. Each time you draw a new shape, you just expect it to appear on the canvas on top of everything that came before…

Contents