<!DOCTYPE html><html> <head> <title></title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> canvas{width: 1000px;height: 500px;} </style> </head> <body> <canvas id="canvas" width="1000" height="500" ></canvas> </body> <script> var canvas = document.getElementById('canvas'); var context = canvas.getContext('2d'); context.beginPath(); context.moveTo(100,200); context.lineTo(200,200); context.moveTo(100,300-0.5); context.lineTo(200,300-0.5); context.stroke(); </script></html>在偶然的情况下。我发现-0.5能实现我想要让线条变细的样式,lineWidth明明是设置线宽,但实际上是附带了颜色深浅。最小只能到1.但是为什么我设置坐标减少0.5后线条反而变细了呢?不太懂。求解
添加回答
举报
0/150
提交
取消