HTML canvas shadowColor property
Examples
Draw a red rectangle with a black shadow:
JavaScript:
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.shadowBlur=20;
ctx.shadowColor="black";
ctx.fillStyle="red";
ctx.fillRect(20,20,100,80);
var ctx=c.getContext("2d");
ctx.shadowBlur=20;
ctx.shadowColor="black";
ctx.fillStyle="red";
ctx.fillRect(20,20,100,80);
try it"
Browser Support
Internet Explorer 9, Firefox, Opera, Chrome and Safari support shadowColor property.
Note: 8 and earlier versions of Internet Explorer do not support the <canvas> element.
Definition and Usage
shadowColor property sets or returns the color for the shadow.
Note: Please shadowColor property shadowBlur property used together to create a shadow.
Tip: By using shadowOffsetX and shadowOffsetY to adjust the shadow effect properties.
Defaults: | # 000000 |
---|---|
JavaScript syntax: | context.shadowColor = color; |
Property Value
值 | 描述 |
---|---|
color | 用于阴影的 CSS 颜色值 。默认值是 #000000。 |
HTML canvas Reference Manual