November 2011
Intermediate to advanced
348 pages
7h 2m
English
For applications that require shape layering, it's often desirable to work with transparencies. In this recipe, we will learn how to set shape transparencies using the global alpha composite.

Follow these steps to draw a transparent circle on top of an opaque square:
window.onload = function(){
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d"); // draw rectangle
context.beginPath();
context.rect(240, 30, 130, 130);
context.fillStyle = "blue";
context.fill();globalAlpha property and ...Read now
Unlock full access