Skip to main content

SurfaceAnimator

Offers several methods for animating parts of a Surface widget

Methods​

animateToPosition()​

animateToPosition(el, x, y, animateOptions?): void

Animate the given vertex to the given [x,y] location.

Parameters​

el​

string | Node | Group | BrowserElement

x​

number

y​

number

animateOptions?​
complete?​

Function

duration?​

number

start?​

Function

step?​

Function

Returns​

void


bind()​

bind<T>(event, listener, insertAtStart?): EventGenerator

Bind a listener to the named event, optionally inserting the listener at the head of the queue for the given event.

Type Parameters​

T​

T = any

The type of the payload you expect to be passed to your callback. Using this is helpful to ensure your callbacks are typed correctly.

Parameters​

event​

any

Name of the event to bind

listener​

(payload, evt?) => any

Function to bind to the event

insertAtStart?​

boolean

Defaults to false. If true, this handler is inserted at the head of the list of listeners for the given event.

Returns​

EventGenerator

Inherited from​

OptimisticEventGenerator.bind


bindAll()​

bindAll<T>(events, listener, insertAtStart?): EventGenerator

Bind a listener to all of the named events, optionally inserting each one at the head of the queue for the given event.

Type Parameters​

T​

T = any

The type of the payload you expect to be passed to your callback. Using this is helpful to ensure your callbacks are typed correctly.

Parameters​

events​

any[]

listener​

(payload, evt?) => any

insertAtStart?​

boolean

Returns​

EventGenerator

Inherited from​

OptimisticEventGenerator.bindAll


bindUnchecked()​

bindUnchecked<T>(event, listener, insertAtStart?): EventGenerator

Bind an event listener. This method can be used with a type parameter by call sites; although it's not necessary it can be helpful to use this to ensure you've thought about what the payload to your event handler is going to be.

Type Parameters​

T​

T = any

The type of the payload you expect to be passed to your callback. Using this is helpful to ensure your callbacks are typed correctly.

Parameters​

event​

string

Name of the event(s) to bind to.

listener​

(a, e?) => any

Function to bind to the given event(s)

insertAtStart?​

boolean

Whether or not to insert this listener at the head of the listener queue. Defaults to false.

Returns​

EventGenerator

Inherited from​

OptimisticEventGenerator.bindUnchecked


traceEdge()​

traceEdge(params): void

Traces an overlay along an edge.

Parameters​

params​

Overlay tracing options

complete?​

Function

edge​

string | Edge

Edge, or edge id, to trace the overlay along

options?​

OverlayAnimationOptions

overlay​

OverlaySpec

Definition of the overlay to trace along the edge.

start?​

Function

Returns​

void


tracePath()​

tracePath(params): PathTransport

Traces an overlay along a path.

Parameters​

params​

Path tracing options

listener?​

PathTransportListener

Optional listener for events.

options?​

OverlayAnimationOptions

Options for the animation.

overlay​

OverlaySpec

Definition of the overlay to trace along the path

path?​

Path

The path to trace. Provide this, or provide source and target

paused?​

boolean

If true, the animation will start in a paused state.

source?​

string | Vertex

Source vertex to trace Path from. Provide this and target, or path.

target​

string | Vertex

Target vertex to trace Path to. Provide this and source, or path.

Returns​

PathTransport


unbind()​

unbind(eventOrListener?, listener?): EventGenerator

Unbind the given event listener, or all listeners. If you call this method with no arguments then all event listeners are unbound.

Parameters​

eventOrListener?​

Either an event name, or an event handler function

string | Function

listener?​

Function

If eventOrListener is defined, this is the event handler to unbind.

Returns​

EventGenerator

Inherited from​

OptimisticEventGenerator.unbind