<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>绘制带阴影的图形</title>
</head>
<body>
<canvas id="my_canvas" width="200" height="200" style="border:1px solid #ff0000">
</canvas>
<script type="text/javascript">
var elem=document.getElementById("my_canvas");
if (elem && elem.getContext) {
var context=elem.getContext('2d');
context.shadowOffsetX=15;
context.shadowOffsetY=15;
context.shadowBlur=10;
context.shadowColor='red';
context.fillStyle='blue';
context.fillRect(20,20,150,100);
}
</script>
</body>
</html>