Scroll To Top
Blog

Shadow Color Attribute of Canvas in HTML5

By Mahak Gupta Mar 11, 2012
This attribute specifies the color of the shadow.
This attribute specifies the color of the shadow. We can define it by the shadowOffsetX, shadowOffsetY, and the shadowBlur property. Here we discuss the shadowBlur Property.

<canvas id="myfirstCanvas" width="250" height="150" style="border:1px solid;#d3d3d3;">
 </canvas>

<script type="text/javascript">

var mycanvas=document.getElementById("myfirstCanvas");
var x=mycanvas.getContext("2d");
x.rect(20,30,40,50);
x.fillStyle="pink";
x.shadowColor="black";
x.shadowBlur=20;
x.fill();

</script>

</body>
</html>

1.png