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?)
Parameter | Type | Default Value |
---|---|---|
x | number | - |
y | number | - |
width | number | - |
height | number | width |
State Configuration
The comportment of the function can be modified by editing this state properties:
state.color
— set the color of the rectangle.state.rectOrigin
— set the origin of the rectangle.state.rectUV
— set the texture coordinates.state.texture
— set the texture.state.textureColorBlend
— set the equation used to mic the color with the texture.