• 欢迎来到本站,本站主要做程序员相关技术、博客、笔记,如果喜欢本网站那么赶紧使用Ctrl+D 收藏吧!
  • 如果有任何疑问,可以在下方文章下方留下你的评论~

Example of using html canvas shadowBlur property

技术文章 8个月前 (10-20) 1次浏览 0个评论

Browser support

Internet Explorer 9, Firefox, opera, chrome, and safari support the shadowBlur property.

Note: the <canvas> element is not supported in Internet Explorer 8 and earlier.

Definition and Usage

The shadowblur property sets or returns the number of blur levels for shadows.

JavaScript syntax: context.shadowBlur=number ;

Example

Draw a red rectangle with a black shadow. The blur level is 20:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HelloWorld</title>
</head>
<body>

<canvas id="myCanvas" width="300" height="150" style="border:1px solid #d3d3d3;">
chinapenpal
</canvas>
<script>
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);
</script>

</body>
</html>

Running ResultRunning Result

Example of using html canvas shadowBlur property


中国笔友, 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Example of using html canvas shadowBlur property
喜欢 (0)
发表我的评论
取消评论
表情 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址