Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
要在 HTML Canvas 上下文上画一条线:
我怀疑您在尝试中错过了对
Stroke()
的调用。请注意,您可以在一个过程中多次调用moveTo()
单个路径,只要您想对所有段使用相同的 lineWidth/linesStyle (听起来像您所做的那样)。To draw a line on an HTML Canvas context:
I suspect you're missing the call to
stroke()
in your attempts. Note that you can callmoveTo()
multiple times during a single path, as long as you want to use the same lineWidth/strokeStyle for all segments (as it sounds like you do).