I

IAnimation

An interface for animations that can be run by Animator.
Inheritance Hierarchy

Remarks

Instances of classes implementing this interface change their state according to a relative animation time. The animation time is a double between 0 for the start of the animation and 1 for the end of the animation.
  • An animated object is first created using the constructor of a subclass.
  • Immediately before the animation a client calls initialize.
  • To change the state of the animated object a client does a series of calls to animate, usually with an increasing relative time parameter.
  • If the animation is done, the client calls cleanUp once.
  • While animate uses a relative time scheme, there might be an absolute time value for the preferred duration of the whole sequence of animation steps. Since an IAnimation instance has no control on the number of animate calls or the intervals between them, the preferred duration is only a hint on how long the animation should take. Clients can ask for that hint using preferredDuration and try to find a suitable sequence of animate calls in order to fulfill the preference.

See Also

Developer's Guide

Members

No filters for this type

Properties

Gets the preferred duration of the animation.
readonlyabstract

Methods

Does the animation according to the relative animation time.
The animation starts with the time 0 and ends with time 1.
abstract

Parameters

time: number
The animation time in [0,1].
Cleans up after an animation has finished.
abstract
Creates a delayed animation instance from this instance.
The resulting animation will have a preferred duration that is delay longer than the existing one.

Parameters

delay: TimeSpan
The delay to wait before the provided animation starts.

Return Value

IAnimation
A new animation that will first wait before the animation starts.
Creates an eased animation for the given base animation.

The animation speed linearly increases up to a easeIn and linearly decreases from easeOut. Between those two points, the animation speed is constant.

The duration of the ease in and ease out is determined by a mapping [0,1] → [0,1]. The mapping has to be increasing to preserve the order of the frames in the decorated animation. In general, we consider continuously differentiable functions f where integral of f′ equals 1 a suitable choice for the mapping.

Parameters

easeIn?: number
The ratio for the ease-in time [0,1] where 0 is the start of the animation and 1 the end. 0.5 is the default value.
easeOut?: number
The ratio for the ease-out time [0,1] where 0 is the start of the animation and 1 the end. 0.5 is the default value.

Return Value

IAnimation
The newly created IAnimation.

See Also

Developer's Guide
Initializes the animation.
Call this method once before subsequent calls to animate.
abstract

Static Methods

Creates a delay animation that does nothing.
This can be useful especially in conjunction with createSequentialAnimation and createParallelAnimation and allows for creating complex multi-sequence animations.
static

Parameters

duration: TimeSpan
The value for the preferredDuration of the created animation

Return Value

IAnimation
An animation that does nothing for the amount of time specified in duration.
Creates a new IAnimation that animates the given edge's bends from its current shape linearly to the shape given by the endBends and final port locations.

The bends of the edge layout are animated from their current location to their target locations. It is assumed that the edge style is a polyline style and the control points are the bends accordingly. The animation works for other styles too, but the effect might not be as expected. The number of bends in endBends can be different to the current number of bends. This will result in the animation automatically removing bends at the end of the animation or inserting new bends accordingly at the beginning of the animation.

The source and target points are also animated to new locations. However, the ports will not be moved by this animation. Instead a separate animation for the ports is needed to actually move IPorts at the ends of the edge if desired.

static

Parameters

graph: IGraph
The graph the animated edge belongs to.
edge: IEdge
The edge layout to animate.
endBends: IPoint[]
The bend positions after the animation.
endSourceLocation: Point
The absolute position of the source port after the animation.
endTargetLocation: Point
The absolute position of the target port after the animation.
preferredDuration: TimeSpan
The preferred duration of the animation.

Return Value

IAnimation
The newly created IAnimation.

See Also

Developer's Guide
Creates a new IAnimation that animates the given layout of all types of graph items.
static

Parameters

graph: IGraph
The graph for which the layout should be animated.
targetNodeLayouts?: IMapper<INode, IRectangle>
The node layouts after the animation.
targetBendLocations?: IMapper<IEdge, IPoint[]>
The bend locations after the animation, for each edge the points are interpreted as the position of the bends along the edge in the given order.
targetPortLocations?: IMapper<IPort, IPortLocationModelParameter>
The IPortLocationModelParameters for each IPort in the graph that will be animated.
targetLayoutParameters?: IMapper<ILabel, ILabelModelParameter>
The label model parameters for each label after the animation.
preferredDuration?: TimeSpan
The preferred duration of the animation.

Return Value

IAnimation
The newly created IAnimation.

See Also

Developer's Guide
Creates a new IAnimation that animates the given label from its current layout linearly to the layout given by the targetLayoutParameter.
This animation will as a side effect assign the targetLayoutParameter to the label at the end of the animation.
static

Parameters

graph: IGraph
The graph that contains the labels.
label: ILabel
The label to animate the parameter of.
targetLayoutParameter: ILabelModelParameter
The target parameter of the label.
preferredDuration: TimeSpan
The preferred duration of the animation.

Return Value

IAnimation
A new instance of IAnimation.

See Also

Developer's Guide
Creates a new IAnimation instance that animates the current graph to the layout given by the layoutGraph instance of the given adapter.
The returned instance is suitable for animating the transition of an IGraph to a layout computed by one of the layout algorithms.
This method is not available unless the module view-layout-bridge is loaded. Either load the module 'view-layout-bridge' explicitly or ensure that the LayoutExecutor type is available at runtime.
static

Parameters

graph: IGraph
the graph for which the layout should be animated
adapter: LayoutGraphAdapter
the LayoutGraphAdapter that contains all target layout information
preferredDuration: TimeSpan
the preferred duration of the animation

Return Value

IAnimation
A new IAnimation instance that animates the current graph to the layout of the given layoutGraph.

Examples

While it is usually recommended to use LayoutExecutor to handle layout calculation and subsequent animation, the IAnimation produced by this method can be used manually, as well:
Using manually created layout animations
const adapter = new LayoutGraphAdapter(graph)
const layoutGraph = adapter.layoutGraph
const layout = new OrthogonalLayout()
layout.applyLayout(layoutGraph)

const layoutAnimation = IAnimation.createLayoutAnimation(
  graph,
  adapter,
  TimeSpan.fromSeconds(1),
)

See Also

Developer's Guide
Creates a new IAnimation that animates the given node from its current layout to the new given targetLayout.
static

Parameters

graph: IGraph
The graph the animated node belongs to.
node: INode
The node whose layout to animate.
targetLayout: IRectangle
The expected node layout after the animation.
preferredDuration: TimeSpan
The preferred duration of the animation.

Return Value

IAnimation
A new instance of IAnimation.

See Also

Developer's Guide
Creates an IAnimation according to the composite design pattern that animates multiple animations in parallel.
The animations can be synchronized to the longest running animation.
static

Parameters

animations: any
The animations to run in parallel.
synchronized?: boolean
Whether all child animations should be adjusted to have the same (maximum) preferredDuration. By default this is enabled.

Return Value

IAnimation
A new instance that is the composite of the given animations.

See Also

Developer's Guide
Creates a new instance of an IAnimation that animates the given IMutablePoint along a path.
static

Parameters

path: GeneralPath
The path to animate the point along.
animationPoint: IMutablePoint
The mutable point instance that will be manipulated by the animation.
preferredDuration: TimeSpan
The preferred duration of the animation.

Return Value

IAnimation
The newly created IAnimation.

See Also

Developer's Guide
Creates a new IAnimation that animates the given port from its current location to the new location given by the targetLocationParameter.
This animation will as a side effect assign the targetLocationParameter to the port at the end of the animation.
static

Parameters

graph: IGraph
The graph that contains the port.
port: IPort
The port to animate.
targetLocationParameter: IPortLocationModelParameter
The parameter to linearly interpolate to.
preferredDuration: TimeSpan
The preferredDuration of this animation.

Return Value

IAnimation
A new instance of IAnimation.

See Also

Developer's Guide
Creates an IAnimation that animates multiple animations in sequence.
Each animation in animations runs in sequence one after another. The duration of the sequential animation is the sum of its child animation durations.
static

Parameters

animations: any
The animations to run in sequence.

Return Value

IAnimation
A new sequential animation from the given animations.

See Also

Developer's Guide
Creates a new IAnimation for the given table that animates the table and its stripes.
Note that only the sizes of leaf stripes, i.e. those without child stripes, are considered. The size of a stripe with children is implicitly determined by its contents.
static

Parameters

table: ITable
The table to animate.
columnLayout: number[]
The sizes of the leaf columns, in natural order.
rowLayout: number[]
The sizes of the leaf rows, in natural order.

Return Value

IAnimation
The newly created IAnimation.
Creates an animation for the given delegate and preferredDuration.
static

Parameters

callback: function(number): void
The callback to use for the animation steps.
duration: TimeSpan
The duration that the animation should last.

Return Value

IAnimation
A new animation that will use the callback to perform the actions.