![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIiZpdmLwV3LcNXZnFWbp9CXt92YuI2bv5Wdy5yd3d3Lc9CX6MHc0RHaiojIsJye.gif)
HTML canvas 參考手冊
繪制一個帶有黑色陰影的紅色矩形,模糊級數是 20:
YourbrowserdoesnotsupporttheHTML5canvastag.
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);
Internet Explorer 9、Firefox、Opera、Chrome 和 Safari 支援 shadowBlur 屬性。
<b>注意:</b>Internet Explorer 8 及之前的版本不支援 <canvas> 元素。
shadowBlur 屬性設定或傳回陰影的模糊級數。
預設值:
JavaScript 文法:
context.shadowBlur=number;
值
描述
number
陰影的模糊級數
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIiZpdmLwV3LcNXZnFWbp9CXt92YuI2bv5Wdy5yd3d3Lc9CX6MHc0RHaiojIsJye.gif)