GeezerVison is showing maxgraph.github.io — Morphing | @maxgraph/core
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 {
const circleLayout = new CircleLayout(graph);
circleLayout.execute(graph.getDefaultParent());
} finally {
const morph = new Morphing(graph);
morph.addListener(mxEvent.DONE, () => {
graph.getDataModel().endUpdate();
});
morph.startAnimation();
}
Constructors
constructor
-
new Morphing( graph: AbstractGraph, steps?: number, ease?: number, delay?: number,): Morphing
Parameters
- graph: AbstractGraph
- steps: number = 6
Optional number of steps in the morphing animation. Default is 6.
- ease: number = 1.5
Optional easing constant for the animation. Default is 1.5.
Optionaldelay: number
Optional delay between the animation steps. Passed to Animation.
Returns Morphing
Properties
cells
cells: Cell[] | null = 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
delay: number
Specifies the delay between the animation steps.
ease
ease: number
Ease-off for movement towards the given vector. Larger values are
slower and smoother. Default is 4.
eventListeners
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
eventsEnabled: boolean = true
Specifies if events can be fired. Default is true.
eventSource
eventSource: EventTarget | null = null
Optional source for events.
step
step: number = 0
Contains the current step.
steps
steps: number
Specifies the maximum number of steps for the morphing.
thread
thread: number | null = null
Reference to the thread while the animation is running.
Methods
addListener
-
addListener(name: string, funct: Function): void
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
animateCell
-
Animates the given cell state using <CellStatePreview.moveState>.
Returns void
destroy
-
Clears all registered event listeners.
Subclasses with a destroy method should call super.destroy() at the end
of their own cleanup to ensure no stale listeners remain.
Returns void
fireEvent
-
fireEvent(evt: EventObject, sender?: EventTarget | null): 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.
Example:
fireEvent(new EventObject("eventName", key1, val1, .., keyN, valN))
Parameters
- evt: EventObject
- sender: EventTarget | null = null
Optional sender to be passed to the listener. Default value is the return value of getEventSource.
Returns void
getDelta
-
Returns the vector between the current rendered state and the future
location of the state after the display will be updated.
getEventSource
-
getEventSource(): EventTarget | null
Returns EventTarget | null
getOriginForCell
-
getOriginForCell(cell?: Cell | null): Point | null
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.
Returns Point | null
isEventsEnabled
-
isEventsEnabled(): boolean
isRunning
-
Returns true if the animation is running.
Returns boolean
removeListener
-
removeListener(funct: Function): void
setEventsEnabled
-
setEventsEnabled(value: boolean): void
setEventSource
-
setEventSource(value: EventTarget | null): void
Parameters
- value: EventTarget | null
Returns void
show
-
Shows the changes in the given .
Returns void
startAnimation
-
Starts the animation by repeatedly invoking updateAnimation.
Returns void
stopAnimation
-
Stops the animation by deleting the timer and fires an Event#DONE.
Returns void
stopRecursion
-
stopRecursion(state?: CellState | null, delta?: Point | null): boolean
Returns true if the animation should not recursively find more
deltas for children if the given parent state has been animated.
Returns boolean
On This Page
Constructors
Properties
Methods