#Node Methods

Programatically control a node with the below methods.

#move

move a node by x, y coordinates
arguments
node.move({ x: 30, y: 20, dur: 500 });
NameTypeDescription
xintegerRelative number of px to move the node on x axis
yintegerRelative number of px to move the node on y axis
durintgerThe milliseconds for animating the move. Set to 0 to move instantly.
returns

null

#toFront

move a node to front on the z axis
arguments
node.toFront();

none

returns

null

#toBack

move a node to back on the z axis
arguments
node.toBack();

none

returns

null

#hide

hide the node
arguments
node.hide();

none

returns

null

#show

show the node
arguments
node.show();

none

returns

null

#toggleFilters

show or hide the node effect (dropshadow, etc)
arguments
node.toggleFilters(blnHide);
NameTypeDescription
blnHidebooleanSet to true ot hide the filter effect
returns

null

#spin

Apply a perpetual spin effect to a node
arguments
node.spin({ angle: 280, duration: 500 });
NameTypeDescription
angleintegerThe angle to spin the node
durationintegerMilliseconds to take for each spin animation
returns

null

#zoom

Zoom in on the node
arguments
node.zoom(zoomPercent, duration, cb);
NameTypeDescription
zoomPercentintegerThe zoom percent
durationintegerMilliseconds to take for the zoom
cbfunctionCallback once the zoom completes
returns

null

#position

Position the node
arguments
node.position(location, cb, easing, dur);
NameTypeDescription
locationstringPosition on the slate to put this node. Options are lowerright, lowerleft, upperright, upperleft and center.
cbfunctionCallback once the position completes
easingfunctionThe easing options
durfunctionThe milliseconds in which to animate the position
returns

null

#disable

Disables the node from any interaction
arguments
node.disable();

None

returns

null

#enable

Enable the node for user interaction
arguments
node.enable();

None

returns

null

#colorPicker.set

Set the background color and opacity for the node
arguments
node.colorPicker.set({ color: '#333', opacity: 1.0 });
NameTypeDescription
colorstringThe hex color for the node. Gradients can also be defined: 90-#031634-#2D579A (angle-start_hex-end_hex)
opacityintegerthe opacity percentage (0.0 - 1.0) for the node color
returns

null

#customShapes.set

Set the node to a custom svg path
arguments
node.customShapes.set(path, width, height, sendCollab);
NameTypeDescription
pathstringThe custom svg path to attach to the node (e.g., M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z)
widthintegerThe width of the shape in px
heightintegerThe height of the shape in px
sendCollabbooleanSet to false to NOT send the collaboration data, defaults to true
returns

null

#editor.set

Set the node to a custom svg path
arguments
node.editor.set(text, fontSize, fontColor, fontOpacity, textXAlign, textYAlign);
NameTypeDescription
textstringThe text to go in the node. Include appropriate \n line breaks where necessary
fontSizeintegerThe width of the shape in px
fontColorstringThe hex color of the text (#333)
fontOpacityintegerThe opacity percentage of the text (0.0 - 1.0)
textXAlignstringText horizontal align (middle, left, right)
textYAlignstringText vertical align (middle, top, bottom)
returns

null

#images.set

Set an image to the background of the node
arguments
node.images.set(img, width, height);
NameTypeDescription
imagestringThe img src url (e.g., https://e.com/i.png)
widthintegerThe width of the image (used for proportionally resizing)
heightintegerThe height of the image (used for proportionally resizing)
returns

null

#links.set

Set a link on the node
arguments
node.links.set({ type: 'url|currentSlate', data: 'https://slatebox.com|other_node_id' }, blnSendCollab);
NameTypeDescription
opts.typestringThe type of link, either url (links to external site) or currentSlate (links to another node on the same slate).
opts.datastringThe link data (either the url or the other node's id)
blnSendCollabbooleanBoolean as to whether to send the collab data
returns

null

#links.unset

Remove a link from the node
arguments
node.links.unset(blnSendCollab);
NameTypeDescription
blnSendCollabbooleanBoolean as to whether to send the collab data
returns

null

#resize.set

Resize a node
arguments
node.resize.set(width, height);
NameTypeDescription
widthintegerWidth in px to resize the node
heightintegerHeight in px to resize the node
returns

null

#rotate.set

Rotate a node
arguments
node.rotate.set(rotationAngle);
NameTypeDescription
rotationAngleintegerThe rotation angle (0-360) to apply
returns

null