CanvasContext.fillRect
Fill the rect.
setFillStyle()
is used to set the color of the fill, by default, its color is black.
Parameters
It is Object type.
Field | Type | Description |
x | Number | The x coordinate of left-upper corner of rect |
y | Number | The y coordinate of left-upper corner of rect |
width | Number | The width of the rect |
height | Number | The height of the rect |
Sample Code
copy
//.js
const ctx = my.createCanvasContext('awesomeCanvas')
ctx.fillRect(20, 20, 250, 80)
ctx.setFillStyle('blue')
ctx.draw()