拖动节点时 Cytoscape 图自动移动(带动画)

Cytoscape graph automove (with animation) when dragging a node

我正在寻找 cola.js 的 this example,其中,当拖动特定节点时,其他节点能够根据我正在拖动的节点的新位置自动移动,我感兴趣的是,您可以看到图形以某种动画形式过渡到新位置。我注意到 cytoscape 使用 cytoscape-automove 扩展来执行此操作,但在每个示例中,我发现节点自动移动时没有动画,也没有执行延迟。你能建议用 cytoscape 做这个的任何方法吗?

cytoscape.js-cola 或多或少地完成了 cola 的工作。选项 infinite: true 在移动节点时为图形设置动画,如您的示例所示。

您只需将可乐 layout 添加到 cy 实例中 – 在使用 npm install cytoscape-cola f.e 安装 cytoscape.js-cola 模块之后。

let options = {
  name: 'cola',
  infinite: true

};
cy.layout( options );
cy.layout.run()