new Node(pos, props)
Constructs a new Node
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
pos |
Array | Array of three Numbers representing the position of the Node in 3D space (x, y, z) | |||||||||
props |
Object | Object containing optional properties of the Node
Properties
|
Methods
(private) _initProps(properties) → {Node}
Initialize Node properties
Parameters:
Name | Type | Description |
---|---|---|
properties |
Object | Options passed in from the constructor |
Returns:
The Node the method was called on
- Type
- Node
addTo(graph) → {Node}
Add the Node to a Graph
Parameters:
Name | Type | Description |
---|---|---|
graph |
Graph | Graph the Node will be added to |
Returns:
The Node the method was called on
- Type
- Node
color() → {String}
Get the color of the Node
Returns:
String hexadecimal representation of the Edge's color
- Type
- String
id() → {String|Number|null}
Get the ID of the Node
Returns:
ID of the Node
- Type
- String | Number | null
pos() → {Array}
Get the position of the Node
Returns:
Array of three Numbers representing the position of the Node in 3D space (x, y, z)
- Type
- Array
Example
var x = 14, y = 20, z = -5;
myNode.pos() === [14, 20, -5];
setColor(color)
Set the color of the Node
Parameters:
Name | Type | Description |
---|---|---|
color |
Number | String | Hexadecimal or CSS-style string representation of a color |
Returns:
The Node the method was called
setPos(pos) → {Node}
Set the position of the Node
Parameters:
Name | Type | Description |
---|---|---|
pos |
Array | Array of three Numbers representing the position of the Node in 3D space (x, y, z) |
Returns:
The Node the method was called on
- Type
- Node
Example
var x = 14, y = 20, z = -5;
myNode.setPos([x, y, z]);