Theme:

Text

Text are individual 3D objects, all text objects which share the same font use one draw call per scene.

Creating a text object:

const textObject = Text("hi!");

or add a Text object in the UI editor: edit-> + icon ->Text.

Properties

const optionalProps = {
  anchorX: "left | center | right", // default = 'left'
  anchorY: "top | center | bottom", // default = 'center'
  lineHeight: 1.1,
  letterSpacing: 1.1,
  wrap: 0.5, // default = 0 (none)
  font: "yourFontAssetName.tff",
  color: new U.Color() | "#fff0f0",
  material: someMaterial,
  // Allocate geometry for 250 characters
  // This is more efficient for dynamic text
  preallocate: 250,
};

const text = Text("Hello World", props);

Methods

// update the text
textObject.set("new string value");

// update text color
textObject.setColor("#fff000");
textObject.setColor(new U.Color());