ActiveTileBase

Tily. ActiveTileBase

new ActiveTileBase()

Implements basic functionality for active tiles and active tile layers.

Members

animations :Array.<Tily.Animation>

The animations currently running on this active tile.

(nullable) centered :boolean

If the text in this tile should be centered. Set this to null to inherit from the parent object.

Default Value:
  • null

compositeMode :string

The composite operation to use when drawing this active tile.

Default Value:
  • "source-over"

(nullable) font :string

The font to use when rendering this active tile. Set this to null to inherit from the parent object.

Default Value:
  • null

(nullable) fontSize :string

The font size to use when rendering this active tile. Set this to null to inherit from the parent object.

Default Value:
  • null

(nullable) fontStyle :string

The font style to use when rendering this active tile. Set this to null to inherit from the parent object.

Default Value:
  • null

(nullable) foreground :string

The foreground colour of this active tile. Set this to null to inherit from the parent object.

Default Value:
  • null

inheritedCentered :boolean

The centering mode in this layer or inherited from the parent object if null.

inheritedCompositeMode :string

The composite operation set in this layer or inherited from the parent object if null.

inheritedFont :string

The font set in this layer or inherited from the parent object if null.

inheritedFontSize :string

The font size set in this layer or inherited from the parent object if null.

inheritedFontStyle :string

The font style set in this layer or inherited from the parent object if null.

inheritedForeground :string

The foreground colour set in this layer or inherited from the parent object if null.

inheritedOffset :Tily.utility.vec2

The offset set in this layer or inherited from the parent object if null.

inheritedOpacity :number

The opacity set in this layer or inherited from the parent object if null.

inheritedOutline :string

The outline set in this layer or inherited from the parent object if null.

inheritedRotation :number

The rotation set in this layer or inherited from the parent object if null.

inheritedScale :Tily.utility.vec2

The scale set in this layer or inherited from the parent object if null.

inheritedShadow :string

The shadow set in this layer or inherited from the parent object if null.

layers :Array.<Tily.ActiveTileLayer>

The layers in this active tile.

(nullable) offset :Tily.utility.vec2

The offset of this active tile measured in tiles. Set this to null to inherit from the parent object.

Default Value:
  • null

(nullable) opacity :number

The opacity of this active tile. Set this to null to inherit from the parent object.

Default Value:
  • null

(nullable) outline :string

The outline width and colour of this active tile. Set this to null to inherit from the parent object.

Default Value:
  • null

(nullable) rotation :number

The rotation angle of this active tile measured in radians. Set this to null to inherit from the parent object.

Default Value:
  • null

(nullable) scale :Tily.utility.vec2

The scale of this active tile. Set this to null to inherit from the parent object.

Default Value:
  • null

(nullable) shadow :string

The shadow width, offset and colour of this active tile. Set this to null to inherit from the parent object.

Default Value:
  • null

Methods

addLayer(layer, zopt) → {Tily.ActiveTileLayer}

Add an active tile layer to this active tile at the specified z-index. If the z-index is undefined, add the layer on top of existing layers, and if the z-index is -1, add the layer below existing layers.

Parameters
Name Type Attributes Description
layer Tily.ActiveTileLayer

The layer to add.

z number <optional>

The z-index at which to add the layer. If this is -1, the layer will be added below existing layers and if it is undefined the layer will be added above existing layers.

Returns

The layer that was added.

Type
Tily.ActiveTileLayer

animateForeground(foreground, optionsopt)

Animate this active tile's foreground colour.

Parameters
Name Type Attributes Description
foreground string

The target foreground colour.

options AnimationOptions <optional>

An optional options object.

animateOffset(x, y, optionsopt)

Animate this active tile's offset.

Parameters
Name Type Attributes Description
x number

The x-coordinate of the target offset position.

y number

The y-coordinate of the target offset position.

options OffsetAnimationOptions <optional>

An optional options object.

animateOpacity(opacity, optionsopt)

Animate this active tile's opacity.

Parameters
Name Type Attributes Description
opacity number

The target opacity.

options AnimationOptions <optional>

An optional options object.

animateOutline(outline, optionsopt)

Animate this active tile's outline.

Parameters
Name Type Attributes Description
outline string

The target outline.

options AnimationOptions <optional>

An optional options object.

animateRotation(angle, optionsopt)

Animate this active tile's rotation.

Parameters
Name Type Attributes Description
angle number

The target angle in radians.

options RotationAnimationOptions <optional>

An optional options object.

animateScale(x, y, optionsopt)

Animate this active tile's scale.

Parameters
Name Type Attributes Description
x number

The target x-scale.

y number

The target y-scale.

options AnimationOptions <optional>

An optional options object.

animateShadow(shadow, optionsopt)

Animate this active tile's fshadow.

Parameters
Name Type Attributes Description
shadow string

The target shadow.

options AnimationOptions <optional>

An optional options object.

draw(elapsedTime)

Handle this active tile's animations.

Parameters
Name Type Description
elapsedTime number

The time elapsed in seconds since the last draw call.

moveLayer(zFrom, zTo, relative) → {boolean}

Move a layer from one z-index to another z-index, either an absolute value or relative to the layer's current z-index.

Parameters
Name Type Description
zFrom number

The z-index of the layer to move.

zTo number

The z-index to move the layer to.

relative boolean

If this is true, the layer will be moved relative to it's current z-index.

Returns

True if a layer was moved successfully.

Type
boolean

pauseAnimations(inheritopt)

Pause all animations below this layer.

Parameters
Name Type Attributes Description
inherit boolean <optional>

If true (default) then pass down to child layers

removeAllLayers()

Remove all layers from this active tile.

removeLayer(zopt) → {Tily.ActiveTileLayer}

Remove a layer at the specified z-index. If the z-index is undefined, remove the top layer and if the z-index is -1, remove the bottom layer. The removed layer is returned.

Parameters
Name Type Attributes Description
z number <optional>

The z-index of the layer to remove. If this is -1, the bottom layer will be removed and if it is undefined the top layer will be removed.

Returns

The layer that was removed.

Type
Tily.ActiveTileLayer

resetAnimations(inheritopt)

Reset all animations below this layer.

Parameters
Name Type Attributes Description
inherit boolean <optional>

If true (default) then pass down to child layers

runAnimations(inheritopt)

Un-pause all animations below this layer.

Parameters
Name Type Attributes Description
inherit boolean <optional>

If true (default) then pass down to child layers

stopAnimations(inheritopt)

Stop and remove all animations below this layer.

Parameters
Name Type Attributes Description
inherit boolean <optional>

If true (default) then pass down to child layers