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
callback
function(SceneNode, number)
Callback, passed each child node and its index.
thisArg
?Object
Optional 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
callback
function(SceneNode, number)
Callback, passed each child node and its index.
thisArg
?Object
Optional 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
callback
function(SceneNode, number): boolean
Filter function, passed each child node and its index.
thisArg
?Object
Optional 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
callback
function(SceneNode, number): *
Map function, passed each child node and its index.
thisArg
?Object
Optional 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
callback
function(SceneNode, number): boolean
Test function, passed each child node and its index.
thisArg
?Object
Optional 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
index
number

Kind: instance method of SceneNodeList

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2023 Adobe. All rights reserved.