Search
DiagramView.Animate Method
See Also
 





Animates the view state.

Namespace: MindFusion.Diagramming.WinForms
Assembly: MindFusion.Diagramming.WinForms

 Syntax

C#  Copy Code

public void Animate (
    ViewAnimation animation
)

Visual Basic  Copy Code

Public Sub Animate( _
    animation As ViewAnimation _
)

 Parameters

animation

A ViewAnimation -derived object.

 Example

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

C#  Copy Code

var endNode = diagram.FindNodeById("end");
if (endNode != null)
{
    var viewSize = diagramView.Viewport.Size;
    var newScroll = new PointF(
        endNode.GetCenter().X - viewSize.Width / 2,
        endNode.GetCenter().Y - viewSize.Height / 2);

    var currentScroll = new PointF(
        diagramView.ScrollX, diagramView.ScrollY);

    diagramView.Animate(
        new ScrollAnimation(
            new AnimationOptions
            {
                FromValue = currentScroll,
                ToValue = newScroll,
                AnimationType = AnimationType.Power,
                EasingType = EasingType.EaseInOut
            }));
}

 See Also