Constructor
new Text(point, text, type, size, weight, maxWidth, offset, stroke, fill, shadow, canvas)
- Description:
- Create a Text object
- Source:
Properties:
Name | Type | Description |
---|---|---|
point |
Point | X & Y axis coordinates |
text |
string | Text to display |
stroke |
Stroke | Stroke properties |
fill |
Fill | Fill properties |
shadow |
Shadow | Shadow properties |
canvas |
HTMLCanvasElement | 2D canvas context |
options |
Options | Options for this object |
position |
Position | Position properties |
mass |
number | Mass of object |
velocity |
Point | X & Y velocity coordinates |
Parameters:
Name | Type | Description |
---|---|---|
point |
Point | X & Y axis coordinates |
text |
string | Text of text object |
type |
string | Font type |
size |
number | Font size |
weight |
string | Font weight |
maxWidth |
number | Font max width |
offset |
Point | Text offset |
stroke |
Stroke | Stroke properties |
fill |
Fill | Fill Properties |
shadow |
Shadow | Shadow properties |
canvas |
string | Canvas Id |
Methods
canvas(value)
- Description:
- Set canvas value
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
value |
string | Canvas id |
canvas() → {string}
- Description:
- Get canvas value
- Source:
- See:
Returns:
Canvas id
- Type
- string
draw(canvas)
- Description:
- Draw this object
- Source:
Parameters:
Name | Type | Description |
---|---|---|
canvas |
string | Canvas Id |
fill() → {Fill}
- Description:
- Set fill properties
- Source:
Returns:
value Fill properties
- Type
- Fill
fill() → {Fill}
- Description:
- Get fill properties
- Source:
Returns:
Fill properties
- Type
- Fill
font() → {string}
- Description:
- Get font
- Source:
Returns:
CSS style font property syntax
- Type
- string
mass(value)
- Description:
- Set mass
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Mass of object |
mass() → {number}
- Description:
- Get mass
- Source:
Returns:
Mass of object
- Type
- number
maxWidth(value)
- Description:
- Set font's max width
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Font's max width |
maxWidth() → {number}
- Description:
- Get font's max width
- Source:
Returns:
Font's max width
- Type
- number
move(degree, distance, drawopt, clearopt)
- Description:
- Move this object
- Source:
- See:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
degree |
number | Direction to move; in degrees | ||
distance |
number | Distance to move | ||
draw |
boolean |
<optional> |
false
|
Draw post movement |
clear |
boolean |
<optional> |
false
|
Clear canvas during each movement |
offset(value)
- Description:
- Set offset
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
value |
Point | Shadow offset |
offset() → {Point}
- Description:
- Get offset
- Source:
- See:
Returns:
Shadow offset
- Type
- Point
options() → {Options}
- Description:
- Get options properties
- Source:
Returns:
Options properties
- Type
- Options
point(value)
- Description:
- Set point
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
value |
Point | X & Y coordinates |
point() → {Point}
- Description:
- Get point
- Source:
- See:
Returns:
X & Y coordinates
- Type
- Point
position() → {Position}
- Description:
- Get position properties
- Source:
Returns:
Position properties
- Type
- Position
rotate(degree, anchoropt, clearopt)
- Description:
- Rotate this object
- Source:
- See:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
degree |
number | Distance to rotate; in degrees | ||
anchor |
string |
<optional> |
'center'
|
Anchoring point during rotation |
clear |
number |
<optional> |
true
|
Clear canvas during each rotation |
shadow() → {Shadow}
- Description:
- Get shadow properties
- Source:
Returns:
Shadow properties
- Type
- Shadow
showCoordinates(offsetopt, fontSizeopt)
- Description:
- Shows coordinates of this object
- Source:
- See:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
offset |
number |
<optional> |
10
|
Offset of coordinates y origin |
fontSize |
number |
<optional> |
16
|
Coordinates font size |
size(value)
- Description:
- Set font's size
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Font's size |
size() → {number}
- Description:
- Get font's size
- Source:
Returns:
Font's size
- Type
- number
stroke() → {Stroke}
- Description:
- Set stroke properties
- Source:
Returns:
value Stroke properties
- Type
- Stroke
stroke() → {Stroke}
- Description:
- Get stroke properties
- Source:
Returns:
Stroke properties
- Type
- Stroke
text(value)
- Description:
- Set text
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string | Text of object |
text() → {string}
- Description:
- Get text
- Source:
Returns:
Text of object
- Type
- string
type(value)
- Description:
- Set font's type
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string | Font's type |
type() → {string}
- Description:
- Get font's type
- Source:
Returns:
Font's type
- Type
- string
velocity(value)
- Description:
- Set velocity
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Velocity of object |
velocity() → {number}
- Description:
- Get velocity
- Source:
Returns:
Velocity of object
- Type
- number
weight(value)
- Description:
- Set font's weight
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string | Font's weight |
weight() → {string}
- Description:
- Get font's weight
- Source:
Returns:
Font's weight
- Type
- string
x(value)
- Description:
- Set x-axis value
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | X coordinate value |
x() → {number}
- Description:
- Get x-axis value
- Source:
- See:
Returns:
X coordinate value
- Type
- number
y(value)
- Description:
- Set the y-axis value
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Y coordinate value |
y() → {number}
- Description:
- Get y-axis value
- Source:
- See:
Returns:
Y coordinate value
- Type
- number