Canvas shadowColor attribute
Definition and usage
shadowColor
property.
Σημείωση:Please set or return the color used for the shadow with the shadowBlur property together to create a shadow.
Tip:Please use the shadowOffsetX and shadowOffsetY Use the attribute to adjust the shadow effect.
Example
Draw a blue rectangle with a black shadow:
JavaScript:
var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.shadowBlur=20; ctx.shadowColor="black"; ctx.fillStyle="blue"; ctx.fillRect(20,20,100,80);
Syntax
context.shadowColor=color;
Attribute value
Value | Description |
---|---|
color | For shadows CSS color values.The default value is #000000. |
Technical details
Default value: | #000000 |
---|
Browser support
Table numbers indicate the first browser version that fully supports this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
4.0 | 9.0 | 3.6 | 4.0 | 10.1 |
Σημείωση:O Internet Explorer 8 και οι προηγούμενες εκδόσεις δεν υποστηρίζουν το στοιχείο <canvas>.