I'd like to add animation like this video

hi, plz see this video:

I want animation like this video when arrange nodes, zoom in and zoom out.
For now, I made this functions:
// Align
onClickAlign() {

// Zoom in
onClickZoomIn() {

// Zoom out
onClickZoomOut() {

These are working without any animation.
How can I add animation like video?

For layout animation, call Diagram.layoutDiagram.

I’m not sure about Diagram scale and position animation.

You can do your own zoom animations if you’d like. You’d want to use requestAnimationFrame and some kind of easing function.

    function ease(t, b, c, d) {
      t /= (d / 2);
      if (t < 1) return c / 2 * t * t + b;
      return -c / 2 * ((--t) * (t - 2) - 1) + b;

    function zoom(factor) {
      var duration = myDiagram.animationManager.duration;
      var start = +new Date();
      var finish = start + duration;
      var newScale = myDiagram.scale * factor;
      var oldScale = myDiagram.scale;

      function zoomTick() {
        var time = +new Date();
        var currentTime = time > finish ? duration : (time - start);
        myDiagram.scale = ease(currentTime, oldScale, newScale - oldScale, duration);
        if (time > finish) return;

    document.getElementById("zoomInBtn").addEventListener("click", function() { zoom(1.5); });
    document.getElementById("zoomOutBtn").addEventListener("click", function() { zoom(2/3); });

Demo here: https://codepen.io/jhardy/pen/qQNmmv?editors=1010

Thank you, jhardy!
It works like a charm! :)

I have another issue.
In the myDiagramDiv, when I zoom in and the content overflows, scroll bar appears.
I want to hide the scroll bar. In the manychat, which I showed in the video shared in loom, scrollbar is invisible at all.
I already set “myDiagramDiv.style.overflow = ‘hidden’” but scrollbar still appears.
In browser inspect mode, I found that there are 2 childs - canvas and div inside of myDiagramDiv.
When content overflows by zooming in, I found that size of canvas changes.
It changes only when content overflows.

So, how can I hide scrollbar?

Wow. So simple. haha :) Thank you.