HTML canvas shadowBlur eigenschap

Definitie en gebruik

shadowBlur Instellen of retourneren van de vaagheidsgraad van de schaduw.

Voorbeeld

Teken een blauwe rechthoek met een zwarte schaduw, de vaagheidsgraad is 20:

Uw browser ondersteunt de canvas tag niet.

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);

Try it yourself

Syntax

context.shadowBlur=number;

Attribute value

Value Description
number The blur level of the shadow

Technical details

Default value: #000000

Browser support

The numbers in the table indicate the first browser version that fully supports this property.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
4.0 9.0 3.6 4.0 10.1

Note:Internet Explorer 8 and earlier versions do not support the <canvas> element.