@physion/app / Exports / TilingSpriteNode
Class: TilingSpriteNode
Base class for all nodes in Physion.
Hierarchy
-
↳
TilingSpriteNode
Constructors
constructor
• new TilingSpriteNode(texture?, width?, height?): TilingSpriteNode
Parameters
| Name | Type | Default value |
|---|---|---|
texture | string | defaultTexture |
width | number | defaultWidth |
height | number | defaultHeight |
Returns
Overrides
Properties
userData
• userData: Record<string, unknown>
Inherited from
EVT_CHILD_ADDED
▪ Static Readonly EVT_CHILD_ADDED: "childAdded"
The name of the event that is emitted whenever a child is added to this node.
The argument supplied is the child that was just added to this node.
Inherited from
EVT_CHILD_REMOVED
▪ Static Readonly EVT_CHILD_REMOVED: "childRemoved"
The name of the event that is emitted whenever a child is removed from this node.
The argument supplied is the child that was just removed from this node.
Inherited from
EVT_CHILD_REORDERED
▪ Static Readonly EVT_CHILD_REORDERED: "childReordered"
The name of the event that is emitted whenever a child of this node is reordered.
The arguments supplied are: (1) The child that was just reordered (2) the old index of the child and (3) the new index of the child.
Inherited from
EVT_NAME_CHANGED
▪ Static Readonly EVT_NAME_CHANGED: "nameChanged"
The name of the event that is emitted whenever the name of this object changes.
The argument suplied is the new CoreObject.name of the object.
Inherited from
EVT_PROPERTY_CHANGED
▪ Static Readonly EVT_PROPERTY_CHANGED: "propertyChanged"
The name of the event that is emitted whenever a property of this object changes.
The arguments supplied are: (1) The name of the property that has changed and (2) the new value of that property.
Inherited from
EVT_TRANSFORM_CHANGED
▪ Static Readonly EVT_TRANSFORM_CHANGED: "transformChanged"
The name of the event that is emitted whenever the x, y or angle properties of this Node are changed.
Note that this event is not emitted when x, y or angle properties are changed as a result of
an update().
Inherited from
ID_LENGTH
▪ Static Readonly ID_LENGTH: 12
Inherited from
MAX_NAME_LENGTH
▪ Static Readonly MAX_NAME_LENGTH: 128
Inherited from
Accessors
alpha
• get alpha(): number
Node's alpha
This value is between 0 (transparent) and 1.0 (opaque). This property can be considered as the "master" opacity of the node. Defaults to 1 (fully opaque)
Returns
number
Inherited from
Node.alpha
• set alpha(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
Inherited from
Node.alpha
angle
• get angle(): number
Node's angle (in degrees)
Returns
number
Inherited from
Node.angle
• set angle(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
Inherited from
Node.angle
childCount
• get childCount(): number
Returns the number of children this node contains.
Returns
number
Inherited from
Node.childCount
children
• get children(): Node[]
Returns the children of this node.
Returns
Node[]
Inherited from
Node.children
flags
• get flags(): CoreObjectFlags
Returns
CoreObjectFlags
Inherited from
Node.flags
height
• get height(): number
Returns
number
• set height(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
id
• get id(): string
Object's (unique) id
Note that the id of the object cannot be set (it is automatically assigned upon construction)
Returns
string
Inherited from
Node.id
metaObject
• get metaObject(): MetaObject
Returns the MetaObject that describes this class
Returns
Overrides
Node.metaObject
name
• get name(): string
The object's name
The object's name is a free text value which defaults to an empty string.
Note that when the name of the object changes, the CoreObject.EVT_NAME_CHANGED signal will be emitted.
Returns
string
Inherited from
Node.name
• set name(v): void
Parameters
| Name | Type |
|---|---|
v | string |
Returns
void
Inherited from
Node.name
parent
• get parent(): undefined | Node
Returns the parent of this node (or undefined if this node has no parent).
Returns
undefined | Node
Inherited from
Node.parent
scripts
• get scripts(): IScript[]
Returns
IScript[]
Inherited from
Node.scripts
• set scripts(v): void
Parameters
| Name | Type |
|---|---|
v | IScript[] |
Returns
void
Inherited from
Node.scripts
texture
• get texture(): string
Returns
string
• set texture(v): void
Parameters
| Name | Type |
|---|---|
v | string |
Returns
void
tileScale
• get tileScale(): number
Returns
number
• set tileScale(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
ttl
• get ttl(): number
Node's time-to-live, in milliseconds.
A value of -1 (the default) means this node has no ttl and will never be automatically removed. Any other value counts down while the simulation is running; once it reaches 0 the node (and any nodes that depend on it) is removed from the Scene.
Has no effect on the Scene node itself, which never counts down or gets removed via ttl.
Returns
number
Inherited from
Node.ttl
• set ttl(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
Inherited from
Node.ttl
visualFilters
• get visualFilters(): IVisualFilters
The visual effects drawn over this node and its children, keyed by types.VisualFilterKey. See VisualFiltersMixin.
Returns
IVisualFilters
Inherited from
Node.visualFilters
• set visualFilters(v): void
Parameters
| Name | Type |
|---|---|
v | IVisualFilters |
Returns
void
Inherited from
Node.visualFilters
width
• get width(): number
Returns
number
• set width(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
x
• get x(): number
Node's x position (in meters)
Returns
number
Inherited from
Node.x
• set x(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
Inherited from
Node.x
y
• get y(): number
Node's y position (in meters)
Returns
number
Inherited from
Node.y
• set y(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
Inherited from
Node.y
Methods
addChild
▸ addChild(child): boolean
Adds the given child to this node.
If the given child is already contained in this node or it already has a Node.parent then this method will fail (false will be returned).
Otherwise the child will be added to this node and the Node.EVT_CHILD_ADDED signal will be emitted.
Parameters
| Name | Type | Description |
|---|---|---|
child | Node | The child to be added to this node. |
Returns
boolean
True on success otherwise false.
Inherited from
addChildren
▸ addChildren(children): void
Convenience method for adding multiple children to this node.
Parameters
| Name | Type |
|---|---|
children | Node[] |
Returns
void
Inherited from
addScript
▸ addScript(assetId, params?): undefined | IScript
Adds a new script to this node.
Convenience wrapper around the scripts property, which validates the entry and rejects it if
malformed. An entry whose asset is not available yet stays inert until it is.
Parameters
| Name | Type | Description |
|---|---|---|
assetId | string | The id of the script's TextAsset. |
params | ScriptParams | Initial values for the script's editable properties. |
Returns
undefined | IScript
A copy of the added script entry, or undefined if it was rejected.
Use its id with getNodeScript() or removeScript().
Inherited from
callMethodForAllNodeScripts
▸ callMethodForAllNodeScripts<T>(methodName, ...args): void
Type parameters
| Name | Type |
|---|---|
T | extends NodeScriptMethodName |
Parameters
| Name | Type |
|---|---|
methodName | T |
...args | Parameters<NonNullable<INodeScriptValue[T]>> |
Returns
void
Inherited from
Node.callMethodForAllNodeScripts
canAddChild
▸ canAddChild(child): boolean
Returns true if the given child can be added to this node
Parameters
| Name | Type |
|---|---|
child | Node |
Returns
boolean
Inherited from
canRemoveChild
▸ canRemoveChild(child): boolean
Returns true if the given child can be removed from this node
Parameters
| Name | Type |
|---|---|
child | Node |
Returns
boolean
Inherited from
childIndex
▸ childIndex(child): number
Returns the index of the given child (or -1 if child is not contained in thie node).
Parameters
| Name | Type |
|---|---|
child | Node |
Returns
number