老师,看一下
来源:4-5 编程练习
陈子长
2018-11-21 16:05:59
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>canvasL</title>
<style>
canvas{background-color:lightblue;}
</style>
</head>
<body>
<canvas id="canvas" width="600px" height="600px">您的浏览器不支持</canvas>
<script>
// 在此处写出代码
var canvas = document.getElementById("canvas");
var context = canvas.getContext('2d');
context.translate(100, 200);
context.rotate(Math.PI / 180 * 60);
context.scale(0.5, 0.5);
context.strokeRect(100, 100, 200, 300);
</script>
</body>
</html>1回答
绘制的矩形应该是黄色的,可以添加填充颜色的代码:

如果填充了颜色,就需要使用fillRect来绘制被填充的矩形。
自己完善测试下,祝学习愉快!