class Text

Extends:
Shape

Description:

Text shape is used to draw text as a shape. It can also have a Stroke, background, and everything like other shapes have.

In Text shape you can also specify font parameters, like name, size, underlines, italic, bold, strikethrough and more. Check out FontFamily enum for generic font family names that can be used for cross-platform compatibility.

Constructor

constructor(text, [font], [stroke=null], [background="#000000"], [opacity=1], [x=0], [y=0])

Constructor of Text shape. Color, Gradient, or background image are specified in "background" argument, because it's a Shape.

Parameters:

Name Type Default Description

text

string

Text to be drawn as shape

[font]

Font

Font object, such as {size: 13, name: "sans-serif", ...}.

[stroke]

Stroke

null

Stroke object.

[background]

string

"#000000"

Background string, CSS style. See Shape > background for details.

[opacity]

number

1

Opacity of the shape. Valid value is a decimal between 0 - 1.

[x]

number

0

X position of top-left corner of text

[y]

number

0

Y position of top-left corner of text

Members

Methods

From this class:

Inherited from Shape: