Animate diagram when change diagram position

Hi. I have a case when I need to animate my diagram when changing diagram’s position x.

diagram.position = new go.Point(diagram.position.x + value, diagram.position.y);

I’ve set up animationManager for diagram, so animationManager.isEnabled: true.
But I don’t see any animation even if I increase animation duration.

How it’s possible to move diagram to specific value (like changing diagram position x) with animation?

Thanks in advance.

You can use the undocumented method, AnimationManager.prepareAutomaticAnimation.

function repositionDiagram() {
  myDiagram.startTransaction("reposition diagram");
  myDiagram.animationManager.prepareAutomaticAnimation("reposition diagram");
  myDiagram.position = new go.Point(100, 100);
  myDiagram.commitTransacation("reposition diagram");
1 Like

@jhardy, thank you so much for your quick response!
I’ve tried and it works great. It’s exactly what I expected.

Do you know why it’s undocumented?
Would it be added to documentation or would it be deprecated in closest future?
What do you think – can this solution be used in long term project?

It will be added in a future version. The API for it is in development, and may change significantly between now and when it is documented.

What do you think – can this solution be used in long term project?

Yes, though you may need to change your code as you update the library.

1 Like