Skip to content

3.7 Text

Jonas de Luna Skulberg edited this page Oct 14, 2023 · 1 revision

Text

Extends:

Implements:

Parameters:

Required:

  • text?: string Text string to display.

Optional:

  • position?: InputPosition Position of the text.
  • color?: string Color of the text.
  • fontSize?: number Text font-size.
  • anchorY?: "top" | "middle" | "bottom" Text y-anchor point.
  • anchorX?: "left" | "center" | "right" Text x-anchor point.
  • weight?: fontWeight Text font-weight.

Default Parameters:

position: [0, 0] as [number, number],
color: "black",
fontSize: 30,
anchorX: "left",
anchorY: "bottom",
weight: "regular" as fontWeight,

Implemented Methods:

  • collidesWith(other: Object3D): boolean
  • distanceTo(other: Object3D<Event>): number

Methods

  • setPosition(position: InputPosition): void Set the component position.
  • setText(text: string): void Set the text content.
Clone this wiki locally