Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transparency context.fill style in canvas html5 [closed]

I write this javascript code :

context.shadowOffsetX = 5;
context.shadowOffsetY = 5;
context.shadowBlur = 4;
context.shadowColor = 'rgba(255, 0, 0, 0.5)';
context.fillStyle = '#f00';
context.fillRect(x, y, w, h);

I add this script on a photo , I want see the color of image , but can not add transparency to this script .

like image 200
mgh Avatar asked Oct 02 '13 07:10

mgh


1 Answers

Try making the fillStyle RGBA, too.

context.fillStyle = 'rgba(255, 0, 0, 0.5)';
context.fillRect(x, y, w, h);
like image 189
MildlySerious Avatar answered Oct 21 '22 22:10

MildlySerious