开发者

<canvas> rect path - how?

开发者 https://www.devze.com 2023-01-28 21:58 出处:网络
I\'m wondering how can I draw a path of a rect (like how 开发者_开发百科I can using lineTo()).I don\'t understand what the problem here is. Doesn\'t the rect method do exactly that?It\'s worth noting

I'm wondering how can I draw a path of a rect (like how 开发者_开发百科I can using lineTo()).


I don't understand what the problem here is. Doesn't the rect method do exactly that?


It's worth noting that the rect() function is different from the strokeRect() and fillRect() functions. These two functions draw on the canvas immediately without the need for beginPath() or stroke()/fill() calls. For example this draws a rectangle on to the canvas:

context.fillStyle = 'red'; context.fillRect(5,5,100,100);

0

精彩评论

暂无评论...
验证码 换一张
取 消