mirror of
https://gitee.com/antv/g6.git
synced 2024-12-05 13:18:40 +08:00
47 lines
899 B
HTML
47 lines
899 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title>图-动画</title>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="mountNode"></div>
|
|
<script src="../build/g6.js"></script>
|
|
<script>
|
|
const data = {
|
|
nodes: [{
|
|
id: 'node1',
|
|
x: 100,
|
|
y: 200
|
|
}],
|
|
};
|
|
const graph = new G6.Graph({
|
|
container: 'mountNode',
|
|
fitView: 'cc',
|
|
height: window.innerHeight,
|
|
animate: true
|
|
});
|
|
graph.read(data);
|
|
setTimeout(() => {
|
|
graph.update('node1', {
|
|
x: 50,
|
|
y: 50
|
|
});
|
|
}, 1000);
|
|
setTimeout(() => {
|
|
graph.update('node1', {
|
|
x: 200,
|
|
y: 50
|
|
});
|
|
}, 1200);
|
|
setTimeout(() => {
|
|
graph.remove('node1');
|
|
}, 2000);
|
|
</script>
|
|
</body>
|
|
</html>
|