是否可以对阴影应用变换?例如,矩形的阴影呈菱形。
<div><canvas id="myCanvas" width="900" height = "700" style="border:solid 1px #000000;"></canvas></div>
<script>
var context = document.getElementById("myCanvas").getContext("2d");
function draw_rectangle() {
context.shadowOffsetX = 50;
context.shadowOffsetY = 50;
context.shadowBlur = 5;
context.shadowColor = "DarkGoldenRod";
context.strokeStyle = "Gold";
context.strokeRect(200, 200, 100, 120);
}
window.onload = draw_rectangle();
</script>