【发布时间】:2021-12-31 17:15:23
【问题描述】:
如何使边缘像行军蚂蚁一样动画并将其指向目标节点?
我尝试像这样使用line-dash-offset 属性,但它没有循环。
风格
{
selector: "edge",
style: {
"curve-style": "taxi",
width: 2,
"target-arrow-shape": "triangle",
"target-arrow-color": "#9dbaea",
"line-style": "dashed",
"line-dash-pattern": [8, 4],
}
}
动画
let loopAnimation = eles => {
eles.animation(
{
style: {
"line-dash-offset": 24,
"line-dash-pattern": [8, 4],
}
},
{
duration: 1000
}
).play().promise('complete').then(() => loopAnimation(eles))
};
cy.edges().forEach(loopAnimation);
【问题讨论】:
标签: javascript diagram cytoscape.js