核心知识
矩形与颜色
fillRect 直接填充矩形,strokeRect 绘制边框;颜色来自当前绘图状态。
- fillStyle 设置填充色
- strokeStyle 设置描边色
- clearRect 清除指定区域
ctx.fillStyle = '#0b5d66';
ctx.fillRect(0, 0, 640, 360);
ctx.strokeStyle = '#ffffff';
ctx.strokeRect(24, 24, 592, 312);
fillRect 直接填充矩形,strokeRect 绘制边框;颜色来自当前绘图状态。
ctx.fillStyle = '#0b5d66';
ctx.fillRect(0, 0, 640, 360);
ctx.strokeStyle = '#ffffff';
ctx.strokeRect(24, 24, 592, 312);