Rectangle

const { rect, mouse, state, frame } = canvas.api
rect(0, 0, 1)
rect(...mouse.pos, 1, .3)
state.rectOrigin = [-1, -1]
rect(0, 0, ...mouse.pos)

Function

rect(x, y, width, height?)
ParameterTypeDefault Value
xnumber-
ynumber-
widthnumber-
heightnumberwidth

State Configuration

The comportment of the function can be modified by editing this state properties: