From 5efc8253bb4e0598c42d48e1db08515f83c93b66 Mon Sep 17 00:00:00 2001 From: kener Date: Tue, 18 Nov 2014 16:57:19 +0800 Subject: [PATCH] enhancement #649 --- src/chart/base.js | 12 +++++++++--- src/util/ecAnimation.js | 5 +++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/chart/base.js b/src/chart/base.js index 1159baf6a7..6f4774e8bd 100644 --- a/src/chart/base.js +++ b/src/chart/base.js @@ -1338,6 +1338,7 @@ define(function (require) { var duration = lastShapeList.length > 0 ? 500 : this.query(this.option, 'animationDuration'); var easing = this.query(this.option, 'animationEasing'); + var delay; var key; var oldMap = {}; var newMap = {}; @@ -1383,7 +1384,12 @@ define(function (require) { else { // 新有旧没有 添加并动画过渡 //this._animateAdd(newMap[key], duration, easing); - this._animateMod(false, newMap[key], duration, easing); + delay = (this.type == ecConfig.CHART_TYPE_LINE + || this.type == ecConfig.CHART_TYPE_RADAR) + && key.indexOf('icon') != 0 + ? duration / 2 + : 0; + this._animateMod(false, newMap[key], duration, easing, delay); } } this.zr.refresh(); @@ -1418,7 +1424,7 @@ define(function (require) { /** * 动画过渡 */ - _animateMod: function (oldShape, newShape, duration, easing) { + _animateMod: function (oldShape, newShape, duration, easing, delay) { switch (newShape.type) { case 'broken-line' : case 'half-smooth-polygon' : @@ -1428,7 +1434,7 @@ define(function (require) { ecAnimation.rectangle(this.zr, oldShape, newShape, duration, easing); break; case 'icon' : - ecAnimation.icon(this.zr, oldShape, newShape, duration, easing); + ecAnimation.icon(this.zr, oldShape, newShape, duration, easing, delay); break; case 'candle' : if (duration > 500) { diff --git a/src/util/ecAnimation.js b/src/util/ecAnimation.js index 6e1e421064..3c0c367dfb 100644 --- a/src/util/ecAnimation.js +++ b/src/util/ecAnimation.js @@ -422,7 +422,7 @@ define(function (require) { * @param {number} duration * @param {tring} easing */ - function icon(zr, oldShape, newShape, duration, easing) { + function icon(zr, oldShape, newShape, duration, easing, delay) { // 避免markPoint特效取值在动画帧上 newShape.style._x = newShape.style.x; newShape.style._y = newShape.style.y; @@ -432,9 +432,10 @@ define(function (require) { if (!oldShape) { // add var x = newShape._x || 0; var y = newShape._y || 0; - newShape.scale = [0, 0, x, y]; + newShape.scale = [0.01, 0.01, x, y]; zr.addShape(newShape); zr.animate(newShape.id, '') + .delay(delay) .when( duration, {scale : [1, 1, x, y]}