Type Definitions
afterDrawFunction(elapsedTime)
animateTextFunction(t, i) → {string}
Parameters
Name | Type | Description |
---|---|---|
t |
string | The starting text. |
i |
number | The interpolation value, between 0 (start) and 1 (finish). |
Returns
The text to use in the active tile.
- Type
- string
AnimationOptions
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
repeat |
boolean |
<optional> |
false | Whether or not this animation should repeat until stopped or only play once. |
reverse |
boolean |
<optional> |
false | Whether or not the animation should play in reverse, ie. from finish to start. |
alternate |
boolean |
<optional> |
false | Whether or not the animation's direction should alternate between forward/reverse on each repeat. This is only valid if repeat is set to true. |
beforeDrawFunction(elapsedTime)
BufferBaseTileInfo
Properties:
Name | Type | Description |
---|---|---|
position |
Tily.utility.vec2 | The tile position. |
activeTiles |
Array.<ActiveTile> | A list of active tiles at a tile position. |
BufferOptions
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
lockedAxis |
string |
<optional> |
"x" | Indicates which axis is used for scaling the tiles, the scale parameter will indicate how many tiles are visible on the locked axis. Should be either "x" or "y". |
initialOffsetX |
number |
<optional> |
0 | The starting offset x-coordinate for this buffer. |
initialOffsetY |
number |
<optional> |
0 | The starting offset y-coordinate for this buffer. |
initialScale |
number |
<optional> |
16 | The starting scale, represents the number of visible tiles along the locked axis. |
maximumScale |
number |
<optional> |
32 | The maximum number of tiles visible along the locked axis. |
minimumScale |
number |
<optional> |
4 | The minimum number of tiles visible along the locked axis. |
clampCamera |
boolean |
<optional> |
false | Clamp the camera offset and zoom so that the buffer always fills the canvas. |
BufferTileInfo
CellBufferOptions
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
cellWidth |
number |
<optional> |
16 | The width of each cell measured in tiles. |
cellHeight |
number |
<optional> |
16 | The height of each cell measured in tiles. |
minimumX |
number |
<optional> <nullable> |
null | The minimum cell x-coordinate. If this is null, the cell buffer will scroll infinitely in the negative-x direction. |
minimumY |
number |
<optional> <nullable> |
null | The minimum cell y-coordinate. If this is null, the cell buffer will scroll infinitely in the negative-x direction. |
maximumX |
number |
<optional> <nullable> |
null | The maximum cell x-coordinate. If this is null, the cell buffer will scroll infinitely in the positive-x direction. |
maximumY |
number |
<optional> <nullable> |
null | The maximum cell y-coordinate. If this is null, the cell buffer will scroll infinitely in the positive-y direction. |
cellFunction |
cellFunction |
<optional> <nullable> |
null | A function for generating cells. |
CellBufferTileInfo
Properties:
Name | Type | Description |
---|---|---|
cell |
Tily.utility.vec2 | The cell coordinate for the specified tile position. |
layers |
Array.<string> | The tile layer characters in z-index order at a tile position. |
cellFunction(buffer, x, y, resolve, reject)
Parameters
Name | Type | Description |
---|---|---|
buffer |
Tily.CellBuffer | The cell buffer that the resulting cell will belong to. |
x |
number | The cell x-coordinate. |
y |
number | The cell y-coordinate. |
resolve |
resolveCellFunction | A function to call if the cell is generated successfully. |
reject |
rejectCellFunction | A function to call if cell generation failed. |
easeFunction(a, b, i) → {any}
Parameters
Name | Type | Description |
---|---|---|
a |
any | The starting value. |
b |
any | The finishing value. |
i |
number | The interpolation value, between 0 (start) and 1 (finish). |
Returns
The interpolated value between a and b.
- Type
- any
finishedCallback(start, finish)
Parameters
Name | Type | Description |
---|---|---|
start |
any | The previous value before transitioning. |
finish |
any | The new value after transitioning. |
mapCallback(x, …arguments) → {boolean}
MoveOffsetTransitionOptions
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
unit |
string |
<optional> |
"" | The unit of measurement for the new offset. If this is set to 'px', the unit will be pixels and if it is set to anything else the unit will be tiles. |
relative |
boolean |
<optional> |
false | True if the movement should be relative to the current offset. |
OffsetAnimationOptions
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
relative |
boolean |
<optional> |
false | True if the movement should be relative to the current offset. |
rejectCellFunction(reason)
Parameters
Name | Type | Description |
---|---|---|
reason |
string | A string containing the reason that cell generation failed. |
resolveCellFunction(cell)
RotationAnimationOptions
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
relative |
boolean |
<optional> |
false | True if the rotation should be relative to the current angle. |
direction |
string |
<optional> |
"" | The rotation direction. This should be 'cw' for clockwise, 'ccw' for counter-clockwise. If this is not 'cw' or 'ccw', the rotation will be in the direction of the smallest change in angle. |
Size
TilyOptions
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
size |
Size |
<optional> <nullable> |
null | The viewport size, or null to use the canvas element dimensions. |
handleResize |
boolean |
<optional> |
true | True if the window resize event should be handled. |
showFPS |
boolean |
<optional> |
false | True if the FPS should be displayed. |
renderLoop |
boolean |
<optional> |
true | True if the render loop should be started automatically. |
beforeDrawFunction |
beforeDrawFunction |
<optional> <nullable> |
null | A function that will be called after clearing the context but before drawing the active buffer. In the context of the function, 'this' will point to the Tily instance. |
afterDrawFunction |
afterDrawFunction |
<optional> <nullable> |
null | A function that will be called after drawing the active buffer. In the context of the function, 'this' will point to the Tily instance. |
TransitionOptions
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
time |
number |
<optional> |
0 | The amount of time in seconds that this transition should take to complete. |
easeFunction |
easeFunction |
<optional> |
Tily.utility.lerp | The easing function to use while transitioning. |
finishedCallback |
finishedCallback |
<optional> <nullable> |
null | A callback function that will be called once the transition has finished. |