find

Find the first node with the given validator. By default, the first argument accepts a string that is used to find the first node with the matching name value. For more advanced queries, you can provide a function to validate any property to find the desired node.

Source:
Example
// returns the first child node under `Cube_1` with the `name` being `Child_Cube_1`
$$$
.find('Cube_1')
.find('Child_Cube_1');

// returns the first child node under `Cube_1` with the `name` being `Child_Cube_2`
$$$
.find(node => node.name === 'Cube_1')
.find('Child_Cube_2');
Parameters:
Name Type Description
name string | function

Either a string or function that is used to find the matching node.

Returns:
  • Chainable api by returning node.
Type
node
Source:
Example
// returns the first node with the `name` being `Cube_1`
$$$.find('Cube_1');

// returns the first node with the `name` being `Cube_1`
$$$.find(node => node.name === 'Cube_1');

// returns the first node with geometry type being 'PlaneBufferGeometry'
$$$.find(node => node.geometry.type === 'PlaneBufferGeometry');
Parameters:
Name Type Attributes Default Description
name string | function

Either a string or function that is used to find the matching node.

root object <optional>
scene

The parent node to traverse the scene. By default, it's the scene.

Returns:
  • Chainable api by returning node.
Type
node

Find the first node with the given validator. By default, the first argument accepts a string that is used to find the first node with the matching name value. For more advanced queries, you can provide a function to validate any property to find the desired node.

The second argument is an optional argument where you can specify the parent node to search for children nodes. By default, it will search from the top of the THREE.js scene.

Source:
Example
// returns the first child node under `Cube_1` with the `name` being `Child_Cube_1`
$$$
.find('Cube_1')
.find('Child_Cube_1');

// returns the first child node under `Cube_1` with the `name` being `Child_Cube_2`
$$$
.find(node => node.name === 'Cube_1')
.find('Child_Cube_2');
Parameters:
Name Type Description
name string | function

Either a string or function that is used to find the matching node.

Returns:
  • Chainable api by returning node.
Type
node
Source:
Example
// returns the first node with the `name` being `Cube_1`
$$$.find('Cube_1');

// returns the first node with the `name` being `Cube_1`
$$$.find(node => node.name === 'Cube_1');

// returns the first node with geometry type being 'PlaneBufferGeometry'
$$$.find(node => node.geometry.type === 'PlaneBufferGeometry');
Parameters:
Name Type Attributes Default Description
name string | function

Either a string or function that is used to find the matching node.

root object <optional>
scene

The parent node to traverse the scene. By default, it's the scene.

Returns:
  • Chainable api by returning node.
Type
node