Search
DiagramView.animate Method
See Also
 






Animates the view state.

Namespace: MindFusion.Diagramming
File: DiagramView.js

 Syntax

JavaScript  Copy Code

function animate (animation)

 Parameters

animation

ViewAnimation. A ViewAnimation -derived object.

 Example

This example centers specified node in the viewport by running a ScrollAnimation:

JavaScript  Copy Code

var endNode = diagram.nodes.find(
    n => n.id == "end");

if (endNode != null)
{
    var viewSize = diagramView.viewport.getSize();
    var newScroll = new Point(
        endNode.center.x - viewSize.width / 2,
        endNode.center.y - viewSize.height / 2);

    var currentScroll = new Point(
        diagramView.scrollX, diagramView.scrollY);

    diagramView.animate(
        new ScrollAnimation(
        {
            fromValue: currentScroll,
            toValue: newScroll,
            animationType: Animations.AnimationType.Power,
            easingType: Animations.EasingType.EaseInOut
        }));
}

 See Also