From 10f3a3b86512f15a5ba6891451c7bbbcc2ded62a Mon Sep 17 00:00:00 2001 From: "xiaoqing.dongxq" Date: Thu, 24 Jan 2019 18:19:22 +0800 Subject: [PATCH] feat(demo): add animate demo --- demos/edge-animate.html | 4 +- demos/hover-animate.html | 155 +++++++++++++++++++++++++++++++++ demos/node-animate.html | 179 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 336 insertions(+), 2 deletions(-) create mode 100644 demos/hover-animate.html create mode 100644 demos/node-animate.html diff --git a/demos/edge-animate.html b/demos/edge-animate.html index 530dd0e926..4f25a988f6 100644 --- a/demos/edge-animate.html +++ b/demos/edge-animate.html @@ -107,7 +107,7 @@ G6.registerEdge('line-dash', { afterDraw(cfg, group) { const shape = group.get('children')[0]; - const length = 200; // 后续 G 增加 totalLength 的接口 + const length = shape.getTotalLength(); // G 增加了 totalLength 的接口 let totalArray = []; for (var i = 0; i < length; i += interval) { totalArray = totalArray.concat(lineDash); @@ -129,7 +129,7 @@ G6.registerEdge('line-growth', { afterDraw(cfg, group) { const shape = group.get('children')[0]; - const length = 200; // 后续 G 增加 totalLength 的接口 + const length = shape.getTotalLength(); // G 增加了 totalLength 的接口 shape.animate({ onFrame(ratio) { diff --git a/demos/hover-animate.html b/demos/hover-animate.html new file mode 100644 index 0000000000..82161be497 --- /dev/null +++ b/demos/hover-animate.html @@ -0,0 +1,155 @@ + + + + + 状态切换动画 + + +
+ + + + \ No newline at end of file diff --git a/demos/node-animate.html b/demos/node-animate.html new file mode 100644 index 0000000000..c7a4141d09 --- /dev/null +++ b/demos/node-animate.html @@ -0,0 +1,179 @@ + + + + + 节点的动画 + + +
+ + + + \ No newline at end of file