Edit in GitHubLog an issue

SceneNodeList

Kind: class

Represents the children of a scenenode. Typically accessed via the SceneNode.children property.

This is not an Array, so you must use .at(i) instead of [i] to access children by index. It has a number of Array-like methods such as forEach for convenience, however. For best performance, iterate the list using these methods rather than repeatedly calling at().

Items in this list are ordered from lowest z order to highest.

Example

Copied to your clipboard
1let node = ...;
2console.log("Node has " + node.children.length + " children");
3console.log("First child: " + node.children.at(0)); // do not use `[0]` - it will not work!
4node.children.forEach(function (childNode, i) {
5 ...
6});

See: SceneNode.children

length#

length: number

Number of children in the list.

Kind: instance property of SceneNodeList Read only: true

forEach()#

forEach(callback, thisArg)

Iterate all children in the list.

ParamTypeDescription
callbackfunction(SceneNode, number)Callback, passed each child node and its index.
thisArg?ObjectOptional value for this when executing the callback.

Kind: instance method of SceneNodeList

forEachRight()#

forEachRight(callback, thisArg)

Iterate all children in the list, in reverse order (highest z order to lowest).

ParamTypeDescription
callbackfunction(SceneNode, number)Callback, passed each child node and its index.
thisArg?ObjectOptional value for this when executing the callback.

Kind: instance method of SceneNodeList

filter()#

filter(callback, thisArg): Array.<SceneNode>

Iterates all children and returns an array of just the children that passed the filter function's test.

ParamTypeDescription
callbackfunction(SceneNode, number): booleanFilter function, passed each child node and its index.
thisArg?ObjectOptional value for this when executing the callback.

Kind: instance method of SceneNodeList

map()#

map(callback, thisArg): Array.<*>

Iterates all children and returns an array of the map function's result value for each child node.

ParamTypeDescription
callbackfunction(SceneNode, number): *Map function, passed each child node and its index.
thisArg?ObjectOptional value for this when executing the callback.

Kind: instance method of SceneNodeList

some()#

some(callback, thisArg): boolean

Iterates children until the test returns true for at least one child. Returns true if the test function returned true for at least one child.

ParamTypeDescription
callbackfunction(SceneNode, number): booleanTest function, passed each child node and its index.
thisArg?ObjectOptional value for this when executing the callback.

Kind: instance method of SceneNodeList

at()#

at(index): SceneNode

Returns the child node at the specified index in the list, or null if index is out of bounds.

Note: calling at() repeatedly (e.g. in a for loop) is not as fast as using SceneNodeList's iteration methods such as forEach(), some(), or map().

ParamType
indexnumber

Kind: instance method of SceneNodeList

Was this helpful?
Copyright © 2021 Adobe. All rights reserved.