Implements animation for morphing cells. Here is an example of using this class for animating the result of a layout algorithm:

graph.getDataModel().beginUpdate();
try
{
let circleLayout = new mxCircleLayout(graph);
circleLayout.execute(graph.getDefaultParent());
}
finally
{
let morph = new Morphing(graph);
morph.addListener(mxEvent.DONE, ()=>
{
graph.getDataModel().endUpdate();
});

morph.startAnimation();
}

Constructor: Morphing

Constructs an animation.

Reference to the enclosing Graph.

Optional number of steps in the morphing animation. Default is 6.

Optional easing constant for the animation. Default is 1.5.

Optional delay between the animation steps. Passed to .

Hierarchy (view full)

Constructors

Properties

cells: null | Cell[] = null

Optional array of cells to be animated. If this is not specified then all cells are checked and animated if they have been moved in the current transaction.

delay: number

Specifies the delay between the animation steps. Defaul is 30ms.

ease: number

Ease-off for movement towards the given vector. Larger values are slower and smoother. Default is 4.

eventListeners: EventListenerObject[] = []

Holds the event names and associated listeners in an array. The array contains the event name followed by the respective listener for each registered listener.

eventsEnabled: boolean = true

Specifies if events can be fired. Default is true.

eventSource: null | EventTarget = null

Optional source for events. Default is null.

graph: Graph

Specifies the delay between the animation steps. Defaul is 30ms.

step: number = 0

Contains the current step.

steps: number

Specifies the maximum number of steps for the morphing.

thread: null | number = null

Reference to the thread while the animation is running.

Methods

  • Binds the specified function to the given event name. If no event name is given, then the listener is registered for all events.

    The parameters of the listener are the sender and an EventObject.

    Parameters

    • name: string
    • funct: Function

    Returns void

  • Dispatches the given event to the listeners which are registered for the event. The sender argument is optional. The current execution scope ("this") is used for the listener invocation (see Utils#bind).

    Example:

    fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN))
    

    Parameters

    • evt: EventObject

      EventObject that represents the event.

    • sender: null | EventTarget = null

      Optional sender to be passed to the listener. Default value is the return value of .

    Returns void

  • Returns the top, left corner of the given cell. TODO: Improve performance by using caching inside this method as the result per cell never changes during the lifecycle of this object.

    Parameters

    • cell: null | Cell = null

    Returns null | Point

  • Returns true if the animation should not recursively find more deltas for children if the given parent state has been animated.

    Parameters

    Returns boolean