textElement

Use the textElement() function to add a text element to your scene.

textElement("Hello world! 👋");

Text size

Adjusting the text size:

textElement("Hello world! 👋", 32);

Text color

Adjusting the text color:

textElement("Hello world! 👋", null, "coral");

.textElement() returns a regular HTML span element.

const span = textElement("Hello world! 👋");

span.style.backgroundColor = "coral";