我认为您可以使用preset
布局来实现自己想要的目标:
cy.nodes().layout({
name: 'preset',
animate: true,
fit: false,
transform: (node) => {
let position = {};
position.x = node.position('x') + 100;
position.y = node.position('y') + 100;
return position;
}
}).run();
有关更多选项,请参见doc。
这是一个JS Bin演示(按动画按钮)。