@physion/app / Exports / ParticleLifeNode
Class: ParticleLifeNode
Base class for all nodes in Physion.
Hierarchy
-
↳
ParticleLifeNode
Constructors
constructor
• new ParticleLifeNode(seed?, worldWidth?, worldHeight?, particleCount?, colorCount?): ParticleLifeNode
Parameters
| Name | Type | Default value |
|---|---|---|
seed | number | defaultSeed |
worldWidth | number | defaultWorldWidth |
worldHeight | number | defaultWorldHeight |
particleCount | number | defaultParticleCount |
colorCount | number | defaultColorCount |
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
beta
• get beta(): number
Returns
number
• set beta(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
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
colorCount
• get colorCount(): number
Returns
number
• set colorCount(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
flags
• get flags(): CoreObjectFlags
Returns
CoreObjectFlags
Inherited from
Node.flags
forceStrength
• get forceStrength(): number
Returns
number
• set forceStrength(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
frictionFactor
• get frictionFactor(): number
Returns
number
• set frictionFactor(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
particleCount
• get particleCount(): number
Returns
number
• set particleCount(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
particleSize
• get particleSize(): number
Returns
number
• set particleSize(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
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
seed
• get seed(): number
Returns
number
• set seed(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
worldHeight
• get worldHeight(): number
Returns
number
• set worldHeight(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
worldWidth
• get worldWidth(): number
Returns
number
• set worldWidth(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
Inherited from
clone
▸ clone(): ParticleLifeNode
Creates and returns a clone of this node.
The clone returned will have the same property values as this node except from its CoreObject.id.
Returns
A clone of this node.
Inherited from
containsChild
▸ containsChild(child): boolean
Returns true if this node contains the given child
Parameters
| Name | Type |
|---|---|
child | Node |
Returns
boolean
Inherited from
destroy
▸ destroy(): void
Returns
void
Overrides
findAncestorByClassName
▸ findAncestorByClassName(className): undefined | Node
Parameters
| Name | Type |
|---|---|
className | string |
Returns
undefined | Node
Inherited from
findChildById
▸ findChildById(id): undefined | Node
Finds and returns the child with the given id.
Parameters
| Name | Type | Description |
|---|---|---|
id | string | The CoreObject.id of the child to search for. |
Returns
undefined | Node
The child with the given id or undefined if no such child exists.
Inherited from
findChildByName
▸ findChildByName(name): undefined | Node
Finds and returns the first child node with the given name.
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The CoreObject.name of the child to search for. |
Returns
undefined | Node
The first child with the given name or undefined if no such child exists.
Inherited from
findDescendantById
▸ findDescendantById(id): undefined | Node
Finds and returns the descendant with the given id.
Parameters
| Name | Type | Description |
|---|---|---|
id | string | The CoreObject.id of the descendant to search for. |
Returns
undefined | Node
The descendant with the given id or undefined if no such descendant exists.
Inherited from
findSceneAssetById
▸ findSceneAssetById(id): undefined | Asset
Finds and returns the asset specified by the given id. Note that the node needs to be parented to a Scene for this method to work.
Parameters
| Name | Type | Description |
|---|---|---|
id | string | The id of the asset to search for. |
Returns
undefined | Asset
The matched Asset of undefined if no such asset exists in the scene.
Inherited from
findSceneAssetByName
▸ findSceneAssetByName(name): undefined | Asset
Finds and returns the asset specified by the given name. Note that the node needs to be parented to a Scene for this method to work. Asset names are not unique, so if more than one asset shares the given name the first match is returned.
Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the asset to search for. |
Returns
undefined | Asset
The matched Asset or undefined if no such asset exists in the scene.
Inherited from
findSceneNode
▸ findSceneNode(): undefined | Node
Uses the Node.findAncestorByClassName to find the Scene that this node is added to. If this node has not yet been added to a scene then this method will return undefined.
Returns
undefined | Node
Inherited from
fromScreen
▸ fromScreen(position, from?, skipUpdate?): IPointData
Parameters
| Name | Type |
|---|---|
position | IPoint |
from? | Node |
skipUpdate? | boolean |
Returns
IPointData
Inherited from
getAncestors
▸ getAncestors(): Node[]
Returns the ancestors of this node
Returns
Node[]
Inherited from
getAssetIds
▸ getAssetIds(): string[]
Returns the ids of the assets that are used by this Node.
Returns
string[]
The ids of the assets that are used by this Node.
Inherited from
getBoundingRect
▸ getBoundingRect(): Rectangle
Returns the bounding rectangle of this node in local coordinates.
The default implementation returns the local bounds of the underlying PIXI container but subclasses can re-implement this method to return their custom bounding rectangle.
Returns
Rectangle
Overrides
getDependencies
▸ getDependencies(): Node[]
Returns the nodes this node depends on. If this node is not added to a [[Scene]] then an empty array will be returned.
Returns
Node[]
Array of nodes this node depends on.
Inherited from
getDependencyIds
▸ getDependencyIds(): string[]
Returns the IDs of all nodes this node depends on. Subclasses that have dependencies (e.g. JointNode) should re-implement this method and return the IDs of the nodes that they depend on. The default implementation returns an empty array.
Returns
string[]
Array of node IDs this node depends on.