Skip to main content

ParticleEmitterNode

@physion/app / Exports / ParticleEmitterNode

Class: ParticleEmitterNode

Base class for all nodes in Physion.

Hierarchy

  • Node

    ParticleEmitterNode

Constructors

constructor

new ParticleEmitterNode(tracedNodeId?, relativePosition?)

Parameters

NameTypeDefault value
tracedNodeIdstringdefaultTracedNodeId
relativePositionIPointdefaultRelativePosition

Overrides

Node.constructor

Properties

userData

userData: any

Inherited from

Node.userData


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

Node.EVT_CHILD_ADDED


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

Node.EVT_CHILD_REMOVED


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

Node.EVT_CHILD_REORDERED


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 name of the object.

Inherited from

Node.EVT_NAME_CHANGED


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

Node.EVT_PROPERTY_CHANGED


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

Node.EVT_TRANSFORM_CHANGED

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

NameType
vnumber

Returns

void

Inherited from

Node.alpha


alphaEnd

get alphaEnd(): number

Returns

number

set alphaEnd(v): void

Parameters

NameType
vnumber

Returns

void


alphaStart

get alphaStart(): number

Returns

number

set alphaStart(v): void

Parameters

NameType
vnumber

Returns

void


angle

get angle(): number

Node's angle (in degrees)

Returns

number

Overrides

Node.angle

set angle(v): void

Parameters

NameType
vnumber

Returns

void

Overrides

Node.angle


blendMode

get blendMode(): string

Returns

string

set blendMode(v): void

Parameters

NameType
vstring

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


colorEnd

get colorEnd(): string

Returns

string

set colorEnd(v): void

Parameters

NameType
vstring

Returns

void


colorStart

get colorStart(): string

Returns

string

set colorStart(v): void

Parameters

NameType
vstring

Returns

void


emitterLifetime

get emitterLifetime(): number

Returns

number

set emitterLifetime(v): void

Parameters

NameType
vnumber

Returns

void


flags

get flags(): CoreObjectFlags

Returns

CoreObjectFlags

Inherited from

Node.flags


frequency

get frequency(): number

Returns

number

set frequency(v): void

Parameters

NameType
vnumber

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


lifetimeMax

get lifetimeMax(): number

Returns

number

set lifetimeMax(v): void

Parameters

NameType
vnumber

Returns

void


lifetimeMin

get lifetimeMin(): number

Returns

number

set lifetimeMin(v): void

Parameters

NameType
vnumber

Returns

void


maxParticles

get maxParticles(): number

Returns

number

set maxParticles(v): void

Parameters

NameType
vnumber

Returns

void


metaObject

get metaObject(): MetaObject

Returns the MetaObject that describes this class

Returns

MetaObject

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 EVT_NAME_CHANGED signal will be emitted.

Returns

string

Inherited from

Node.name

set name(v): void

Parameters

NameType
vstring

Returns

void

Inherited from

Node.name


noRotation

get noRotation(): boolean

Returns

boolean

set noRotation(v): void

Parameters

NameType
vboolean

Returns

void


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


particleTexture

get particleTexture(): string

Returns

string

set particleTexture(v): void

Parameters

NameType
vstring

Returns

void


pos

get pos(): IPoint

Returns

IPoint

set pos(v): void

Parameters

NameType
vIPoint

Returns

void


relativePosition

get relativePosition(): IPoint

Returns

IPoint

set relativePosition(v): void

Parameters

NameType
vIPoint

Returns

void


rotationSpeedMax

get rotationSpeedMax(): number

Returns

number

set rotationSpeedMax(v): void

Parameters

NameType
vnumber

Returns

void


rotationSpeedMin

get rotationSpeedMin(): number

Returns

number

set rotationSpeedMin(v): void

Parameters

NameType
vnumber

Returns

void


scaleEnd

get scaleEnd(): number

Returns

number

set scaleEnd(v): void

Parameters

NameType
vnumber

Returns

void


scaleStart

get scaleStart(): number

Returns

number

set scaleStart(v): void

Parameters

NameType
vnumber

Returns

void


scene

get scene(): undefined | Scene

Returns

undefined | Scene


scripts

get scripts(): string[]

Returns

string[]

Inherited from

Node.scripts

set scripts(v): void

Parameters

NameType
vstring[]

Returns

void

Inherited from

Node.scripts


spawnCircle

get spawnCircle(): any

Returns

any

set spawnCircle(v): void

Parameters

NameType
vany

Returns

void


spawnRect

get spawnRect(): any

Returns

any

set spawnRect(v): void

Parameters

NameType
vany

Returns

void


spawnType

get spawnType(): string

Returns

string

set spawnType(v): void

Parameters

NameType
vstring

Returns

void


speedEnd

get speedEnd(): number

Returns

number

set speedEnd(v): void

Parameters

NameType
vnumber

Returns

void


speedStart

get speedStart(): number

Returns

number

set speedStart(v): void

Parameters

NameType
vnumber

Returns

void


startRotationMax

get startRotationMax(): number

Returns

number

set startRotationMax(v): void

Parameters

NameType
vnumber

Returns

void


startRotationMin

get startRotationMin(): number

Returns

number

set startRotationMin(v): void

Parameters

NameType
vnumber

Returns

void


tracedNode

get tracedNode(): undefined | Node

Returns

undefined | Node


tracedNodeId

get tracedNodeId(): string

Returns

string

set tracedNodeId(v): void

Parameters

NameType
vstring

Returns

void


x

get x(): number

Node's x position (in meters)

Returns

number

Overrides

Node.x

set x(v): void

Parameters

NameType
vnumber

Returns

void

Overrides

Node.x


y

get y(): number

Node's y position (in meters)

Returns

number

Overrides

Node.y

set y(v): void

Parameters

NameType
vnumber

Returns

void

Overrides

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 parent then this method will fail (false will be returned).

Otherwise the child will be added to this node and the EVT_CHILD_ADDED signal will be emitted.

Parameters

NameTypeDescription
childNodeThe child to be added to this node.

Returns

boolean

True on success otherwise false.

Inherited from

Node.addChild


addChildren

addChildren(children): void

Convenience method for adding multiple children to this node.

Parameters

NameType
childrenNode[]

Returns

void

Inherited from

Node.addChildren


canAddChild

canAddChild(child): boolean

Returns true if the given child can be added to this node

Parameters

NameType
childNode

Returns

boolean

Inherited from

Node.canAddChild


canRemoveChild

canRemoveChild(child): boolean

Returns true if the given child can be removed from this node

Parameters

NameType
childNode

Returns

boolean

Inherited from

Node.canRemoveChild


childIndex

childIndex(child): number

Returns the index of the given child (or -1 if child is not contained in thie node).

Parameters

NameType
childNode

Returns

number

Inherited from

Node.childIndex


clone

clone(): Node

Creates and returns a clone of this node.

The clone returned will have the same property values as this node except from its id.

Returns

Node

A clone of this node.

Inherited from

Node.clone


containsChild

containsChild(child): boolean

Returns true if this node contains the given child

Parameters

NameType
childNode

Returns

boolean

Inherited from

Node.containsChild


destroy

destroy(): void

Returns

void

Overrides

Node.destroy


findAncestorByClassName

findAncestorByClassName(className): undefined | Node

Parameters

NameType
classNamestring

Returns

undefined | Node

Inherited from

Node.findAncestorByClassName


findChildById

findChildById(id): undefined | Node

Finds and returns the child with the given id.

Parameters

NameTypeDescription
idstringThe 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

Node.findChildById


findChildByName

findChildByName(name): undefined | Node

Finds and returns the first child node with the given name.

Parameters

NameTypeDescription
namestringThe 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

Node.findChildByName


findDescendantById

findDescendantById(id): undefined | Node

Finds and returns the descendant with the given id.

Parameters

NameTypeDescription
idstringThe 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

Node.findDescendantById


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

NameTypeDescription
idstringThe 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

Node.findSceneAssetById


findSceneNode

findSceneNode(): undefined | Node

Uses the 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

Node.findSceneNode


getAbsolutePosition

getAbsolutePosition(): undefined | IPoint

Returns the absolute position of this ParticleEmitterNode. The absolute position of a ParticleEmitterNode is only defined if its tracedNode is defined.

Returns

undefined | IPoint


getAncestors

getAncestors(): Node[]

Returns the ancestors of this node

Returns

Node[]

Inherited from

Node.getAncestors


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

Node.getAssetIds


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

Node.getBoundingRect


getDescendants

getDescendants(reversed?): Node[]

Returns the descendants of this node.

A descendant is node that has this node as an ancestor. Consider for example the following tree of nodes:

  • NodeA
    • NodeB
      • NodeD
      • NodeE
    • NodeC

If we ask for the descendants of NodeA we'll get back: [NodeB, NodeD, NodeE, NodeC]

If reversed is set to true then this method will return the reversed descendants. For the example above, that would be: [NodeC, NodeE, NodeD, NodeB, NodeA]. Note that the first item of the reversed descendants has the highest z-index.

Parameters

NameTypeDefault value
reversedbooleanfalse

Returns

Node[]

A list of this node's descendants

Inherited from

Node.getDescendants


getExtras

getExtras(): any

Returns any extra data that this object needs to save during serialization.

In some cases an object might need to save some extra data without necessarily this extra data being part of its state (e.g. the AssetsLibrary of a Scene). In these cases subclasses can re-implement this method and return the data required.

The default implementation returns undefined meaning that no extra data needs to be saved during serialization.

Returns

any

Inherited from

Node.getExtras


getFilteredDescendants

getFilteredDescendants<T>(cls): T[]

Returns the descendants of this node that are instances of the class cls

Type parameters

NameType
Textends Node<T>

Parameters

NameType
clsConstructor<T>

Returns

T[]

Inherited from

Node.getFilteredDescendants


getFilteredDescendantsByClassName

getFilteredDescendantsByClassName(className): Node[]

Returns the descendants of this node that are instances of the class className

Parameters

NameType
classNamestring

Returns

Node[]

Inherited from

Node.getFilteredDescendantsByClassName


getLocalTransform

getLocalTransform(): Matrix

Returns a copy of this node's (local) transformation matrix.

Returns

Matrix

Inherited from

Node.getLocalTransform


getPosition

getPosition(): IPoint

Convenience method which returns the node's position as a x,y object

Returns

IPoint

Inherited from

Node.getPosition


getSceneBoundingRect

getSceneBoundingRect(): Rectangle

Returns the bounding rect of this node in scene coordinates.

Returns

Rectangle

Inherited from

Node.getSceneBoundingRect


getScenePosition

getScenePosition(): IPoint

Returns the Node's position in Scene coordinates.

Returns

IPoint

Inherited from

Node.getScenePosition


getSceneTransform

getSceneTransform(): Matrix

Returns a copy of this node's scene transformation matrix. Use this matrix to map coordinates from this node's local coordinate system to the scene's coordinate system. To map coordinates from the scene, you must first invert the returned matrix.

Unlike getLocalTransform(), which returns only the local transformation, this function includes the node's (and any parents') position, and all the transfomation properties.

Returns

Matrix

Inherited from

Node.getSceneTransform


getShape

getShape(): Polygon

Returns the shape of this Node in local coordinates.

Note that the returned shape might be empty.

The shape of a Node is used for many things, including boolean operations and selection.

The default implementation calls getBoundingRect() to return a simple rectangular shape, but subclasses can reimplement this function to return a more accurate shape for non-rectangular items.

Returns

Polygon

Inherited from

Node.getShape


getSnapPoints

getSnapPoints(snapMode): ISnapPoint[]

Snap Points

Parameters

NameType
snapModenumber

Returns

ISnapPoint[]

Overrides

Node.getSnapPoints


getState

getState(minified?): any

Returns this object's state

The object's state is an object containing key/value pairs corresponding to this object's properties. For example:

{
id: "Ssba4ch5ruok",
name: "Circle",
radius: 2,
// ...
}

To avoid including properties that are currently in their default value you can set minified = true when calling getState.

Note that read-only properties are not part of the object's state (with the exception of the id)

Parameters

NameTypeDefault valueDescription
minifiedbooleanfalseWhether to return a minified state or not

Returns

any

Inherited from

Node.getState


getTransformedShape

getTransformedShape(): Polygon

Returns the shape of this Node in scene coordinates.

Note that the returned shape might be empty.

Returns

Polygon

Inherited from

Node.getTransformedShape


index

index(): number

Returns the index of this Node relatively to its parent. If this Node has no parent then -1 is returned.

Returns

number

Inherited from

Node.index


initNode

initNode(x?, y?, angle?): void

Convenience method for setting node's x, y and angle

Parameters

NameTypeDefault value
xnumber0
ynumber0
anglenumber0

Returns

void

Inherited from

Node.initNode


insertChild

insertChild(child, index): boolean

Parameters

NameType
childNode
indexnumber

Returns

boolean

Inherited from

Node.insertChild


isDestroyed

isDestroyed(): boolean

Returns true if this node has been destroyed via destroy(). A destroyed Node should not be used.

Returns

boolean

Inherited from

Node.isDestroyed


isSelected

isSelected(): boolean

Returns true if this node is currently selected.

Returns

boolean

Inherited from

Node.isSelected


move

move(d): void

Moves this node by the given d.x, d.y

Parameters

NameType
dIPoint

Returns

void

Inherited from

Node.move


removeAllChildren

removeAllChildren(): void

Convenience method which removes all children of this node

Returns

void

Inherited from

Node.removeAllChildren


removeChild

removeChild(child): boolean

Parameters

NameType
childNode

Returns

boolean

Inherited from

Node.removeChild


removeChildren

removeChildren(children): void

Convenience method for removing multiple children from this node.

Parameters

NameType
childrenNode[]

Returns

void

Inherited from

Node.removeChildren


reorderChild

reorderChild(child, newIndex): boolean

Moves a child node to a different position (order) among the other children If the operation is successul then the EVT_CHILD_REORDERED signal will be emitted

Parameters

NameTypeDescription
childNodeThe child node to be moved
newIndexnumberThe new index where the child node will be moved

Returns

boolean

true on success otherwise false

Inherited from

Node.reorderChild


setEmitterConfig

setEmitterConfig(emitterConfig): void

Parameters

NameType
emitterConfigParticleEmitterConfig

Returns

void


setExtras

setExtras(_x): boolean

Sets any extra data that this object needs during de-serialization.

Returns true on success, otherwise returns false.

The default implementation does nothing and returns true.

Parameters

NameType
_xany

Returns

boolean

Inherited from

Node.setExtras


setFlag

setFlag(flag, on?): void

Parameters

NameTypeDefault value
flagCoreObjectFlagsundefined
onbooleantrue

Returns

void

Inherited from

Node.setFlag


setPosition

setPosition(v): void

Convenience method for setting the node's position to the given x,y

Parameters

NameType
vIPoint

Returns

void

Inherited from

Node.setPosition


setScenePosition

setScenePosition(v): void

Sets the Node's scene position.

Parameters

NameType
vIPoint

Returns

void

Inherited from

Node.setScenePosition


setSelected

setSelected(selected): void

Parameters

NameType
selectedboolean

Returns

void

Overrides

Node.setSelected


setState

setState(state, updateId?): boolean

Sets the object's state

Parameters

NameTypeDefault valueDescription
stateanyundefinedThe state to be set
updateIdbooleantrueWhether to also update the id property

Returns

boolean

True on success otherwise false

Inherited from

Node.setState


testFlag

testFlag(flag): boolean

Parameters

NameType
flagCoreObjectFlags

Returns

boolean

Inherited from

Node.testFlag


toGlobal

toGlobal(position, skipUpdate?): IPointData

Parameters

NameType
positionIPoint
skipUpdate?boolean

Returns

IPointData

Inherited from

Node.toGlobal


toLocal

toLocal(position, from?, skipUpdate?): IPointData

Parameters

NameType
positionIPoint
from?Node
skipUpdate?boolean

Returns

IPointData

Inherited from

Node.toLocal


update

update(delta): void

Updates this node.

The default update will do the following:

  • If this node has a script attached to it then it will call the script's update method
  • Call update for each child of this node.

Parameters

NameTypeDescription
deltanumberNot currently used

Returns

void

Overrides

Node.update