shadowBlur表示阴影效果如何延伸double值。浏览器在阴影智商运用高斯模糊时,将会用到该值,它与像素无关,只会被用到高斯模糊方程之中,其默认值为0
shadowColor CSS格式的颜色字符串,默认值是rgba(0,0,0,0)
shadowOffsetX 阴影在X轴方向的偏移量,以像素为单位,默认值为0
shadowOffsetY 阴影在Y轴方向的偏移量,以像素为单位,默认值是0
var canvas_2=document.getElementById("canvas_2");
var can2_context=canvas_2.getContext("2d");
var SHADOW_COLOR='rgba(0,0,0,0.7)'
function setShadow(){
can2_context.shadowColor=SHADOW_COLOR;
can2_context.shadowOffsetX=3;
can2_context.shadowOffsetY=3;
can2_context.shadowBlur=5
}
setShadow();
can2_context.fillStyle="blue"
can2_context.fillRect(0,0,100,100)