It is an area in which there is a text inside. You can define the background color, the text, the size of the area...
const textArea = canvasUI.composite.new("textArea-1", "textArea") textArea.set("size", { width: { unit: "px", value: 250 }, height: { unit: "px", value: 100 }, }) textArea.set("text", "Hello World!") textArea.set("font", { family: "Poppins", size: 20, weight: 700, }) textArea.set("color", "#FFF") textArea.set("background", "#f94144") textArea.set("border", { size: 10, color: "#e03b3d" }) textArea.set("corner", { type: "round", size: 10 })
It is the size of the composite. It is an object with these properties:
Each of these properties can be "auto"
to make the size adapt to the size of its text, and it can also be an object with these properties:
"px"
and "%"
.If the unit is "px"
the value will be in px. If it is "%"
the value will be the percentage of its maximum available size.
Its default value is:
{ width: "auto", height: "auto" }
It is the text that has to draw. Its default value is:
"Text"
It is the font of the text. It is an object that has these properties:
Its default value is:
{ family: "Courier New", size: 16, weight: 400 }
It is the color of the text. Its default value is:
"#000"
It is the background color of the composite. Its default value is
"rgba(0,0,0,0)"
It is the border of the layout. It is an object with these properties:
Its default value is:
{ size: 0, color: "#000" }
It defines how the corners are drawn. It is an object with these properties:
"cut"
to define that the corners have to be cut, and it can also be "round"
to define that the corners have to be rounded.Its default value is:
{ type: "cut", size: 0 }
It is used to align the text inside the area. It is an object with these properties:
"left"
, "middle"
and "right"
."top"
, "middle"
and "bottom"
.Its default value is:
{ horizontal: "middle", vertical: "middle" }
It is the margin of the text in its area. It is an object with these properties:
Its default value is:
{ top: 0, right: 0, bottom: 0, left: 0 }