I am trying to understand how I can draw something on the canvas and show only the shadow, for example:
var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.shadowBlur=100; ctx.shadowOffsetX = 150; ctx.shadowColor="red"; ctx.fillStyle="rgba(0,0,0,0.7)"; ctx.fillRect(20,20,100,80);
Here I draw a black rectangle and add a red shadow with an offset, I would like to see only a shadow without a rectangle.
As you can see in the example, I tried using the rgba color, but when I set the opacity, it also affects the shadow.
here is the fiddle for this code: http://jsfiddle.net/YYvFw/
source share