Hello,
I have the following code for animate drawing of the nodes but i get the error: The edge target must have an existing node id. and TypeError: undefined is not an object (evaluating ‘sigma.plugins.animate’).
var dictionary={
"nodes": [
{
"id": "n0",
"label": "0",
"x": 0,
"y": 0,
"size": 3
},
{
"id": "n1",
"label": "1",
"x": 3,
"y": 1,
"size": 2
},
{
"id": "n2",
"label": "2",
"x": 1,
"y": 3,
"size": 1
},
{
"id": "n3",
"label": "3",
"x": 5,
"y": 2,
"size": 2
},
{
"id": "n4",
"label": "4",
"x": 0,
"y": 2,
"size": 2
},
{
"id": "n5",
"label": "5",
"x": 1,
"y": 3,
"size": 1
}
],
"edges": [
{
"id": "e0",
"source": "n0",
"target": "n1"
},
{
"id": "e1",
"source": "n1",
"target": "n2"
},
{
"id": "e2",
"source": "n2",
"target": "n0"
},
{
"id": "e3",
"source": "n0",
"target": "n3"
},
{
"id": "e4",
"source": "n3",
"target": "n4"
}
,
{
"id": "e5",
"source": "n4",
"target": "n5"
}
,
{
"id": "e6",
"source": "n5",
"target": "n6"
}
,
{
"id": "e7",
"source": "n6",
"target": "n7"
}
]
}
s = new sigma({
graph: dictionary,
container: 'graph-container',
settings: {
animationsTime: 2000
}
});
function animate() {
sigma.plugins.animate(s,
{
x: 'target_x',
y: 'target_y'
},
{
onComplete: function() {
s.graph.nodes('n0').hidden = !(s.graph.nodes('n0').hidden);
animate();
}
}
);
}
animate();