Class jaws.Text
- Defined in: text.js
Constructor Attributes | Constructor Name and Description |
---|---|
jaws.Text(options)
jaws.Text constructor
|
Field Attributes | Field Name and Description |
---|---|
The default values of jaws.Text properties
|
Method Summary
Method Attributes | Method Name and Description |
---|---|
asCanvas()
Returns text as a canvas
|
|
Returns sprite as a canvas context.
|
|
Returns Text's properties as a pure object
|
|
draw()
Draw sprite on active canvas or update its DOM-properties
|
|
move(x, y)
Modify x and/or y by a fixed amount
|
|
moveTo(x, y)
Move object to position x, y
|
|
rect()
Returns a jaws.Rect() perfectly surrouning text.
|
|
resize(width, height)
Resize sprite by adding width or height
|
|
resizeTo(width, height)
Resize sprite to exact width/height
|
|
rotate(value)
Rotate sprite by value degrees
|
|
rotateTo(value)
Forces a rotation-angle on sprite
|
|
set(options)
Overrides constructor values with defaults
|
|
setAnchor(value)
The anchor could be describe as "the part of the text will be placed at x/y"
or "when rotating, what point of the of the text will it rotate round"
|
|
setBottom(value)
Position sprites bottom on the y-axis
|
|
setHeight(value)
Set new height.
|
|
setLeft(value)
Position sprites left side on the x-axis
|
|
setRight(value)
Position sprites right side on the x-axis
|
|
setTop(value)
Position sprites top on the y-axis
|
|
setWidth(value)
Set new width.
|
|
setX(value)
Sets x
|
|
setY(value)
Sets y
|
|
toJSON()
Returns a JSON-string representing the properties of the Text.
|
|
toString()
Returns Text's properties as a String
|
Class Detail
jaws.Text(options)
jaws.Text constructor
- Parameters:
- {object} options
- An object-literal collection of constructor values
Field Detail
default_options
The default values of jaws.Text properties
Method Detail
-
asCanvas()Returns text as a canvas
-
asCanvasContext()Returns sprite as a canvas context. (For certain browsers, a canvas context is faster to work with then a pure image.)
-
{object} attributes()Returns Text's properties as a pure object
- Returns:
- {object}
-
{this} draw()Draw sprite on active canvas or update its DOM-properties
- Returns:
- {this} The current function instance
-
{this} move(x, y)Modify x and/or y by a fixed amount
- Parameters:
- {type} x
- The additional amount to move x
- {type} y
- The additional amount to move y
- Returns:
- {this} Current function instance
-
{this} moveTo(x, y)Move object to position x, y
- Parameters:
- {number} x
- The x position to move to
- {number} y
- The y position to move to
- Returns:
- {this} Current function instance
-
{jaws.Rect} rect()Returns a jaws.Rect() perfectly surrouning text.
- Returns:
- {jaws.Rect}
-
{this} resize(width, height)Resize sprite by adding width or height
- Parameters:
- {number} width
- {number} height
- Returns:
- {this}
-
{this} resizeTo(width, height)Resize sprite to exact width/height
- Parameters:
- {number} width
- {number} height
- Returns:
- {this}
-
{this} rotate(value)Rotate sprite by value degrees
- Parameters:
- {number} value
- The amount of the rotation
- Returns:
- {this} Current function scope
-
{this} rotateTo(value)Forces a rotation-angle on sprite
- Parameters:
- {number} value
- The amount of the rotation
- Returns:
- {this} Current function instance
-
{this} set(options)Overrides constructor values with defaults
- Parameters:
- {object} options
- An object-literal collection of constructor values
- Returns:
- {this}
- See:
- jaws.parseOptions
-
{this} setAnchor(value)The anchor could be describe as "the part of the text will be placed at x/y" or "when rotating, what point of the of the text will it rotate round"
For example, a topdown shooter could use setAnchor("center") --> Place middle of the ship on x/y .. and a sidescroller would probably use setAnchor("center_bottom") --> Place "feet" at x/y
- Parameters:
- {string} value
- Returns:
- {this} The current function instance
-
{this} setBottom(value)Position sprites bottom on the y-axis
- Parameters:
- {number} value
- Returns:
- {this} The current function instance
-
{this} setHeight(value)Set new height.
- Parameters:
- {number} value
- The new height
- Returns:
- {this}
-
{this} setLeft(value)Position sprites left side on the x-axis
- Parameters:
- {number} value
- Returns:
- {this} The current function instance
-
{this} setRight(value)Position sprites right side on the x-axis
- Parameters:
- {number} value
- Returns:
- {this} The current function instance
-
{this} setTop(value)Position sprites top on the y-axis
- Parameters:
- {number} value
- Returns:
- {this} The current function instance
-
{this} setWidth(value)Set new width.
- Parameters:
- {number} value
- The new width
- Returns:
- {this}
-
{this} setX(value)Sets x
- Parameters:
- {number} value
- The new x value
- Returns:
- {this} The current function instance
-
{this} setY(value)Sets y
- Parameters:
- {number} value
- The new y value
- Returns:
- {this} The current function instance
-
{string} toJSON()Returns a JSON-string representing the properties of the Text.
- Returns:
- {string}
-
{string} toString()Returns Text's properties as a String
- Returns:
- {string}