(
lineData: SeriesData,
effectModel: Model<LineDrawModelOption['effect']>,
idx: number
)
| 110 | } |
| 111 | |
| 112 | private _updateEffectAnimation( |
| 113 | lineData: SeriesData, |
| 114 | effectModel: Model<LineDrawModelOption['effect']>, |
| 115 | idx: number |
| 116 | ) { |
| 117 | |
| 118 | const symbol = this.childAt(1) as ECSymbolOnEffectLine; |
| 119 | if (!symbol) { |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | const points = lineData.getItemLayout(idx); |
| 124 | |
| 125 | let period = effectModel.get('period') * 1000; |
| 126 | const loop = effectModel.get('loop'); |
| 127 | const roundTrip = effectModel.get('roundTrip'); |
| 128 | const constantSpeed = effectModel.get('constantSpeed'); |
| 129 | const delayExpr = zrUtil.retrieve(effectModel.get('delay'), function (idx) { |
| 130 | return idx / lineData.count() * period / 3; |
| 131 | }); |
| 132 | |
| 133 | // Ignore when updating |
| 134 | symbol.ignore = true; |
| 135 | |
| 136 | this._updateAnimationPoints(symbol, points); |
| 137 | |
| 138 | if (constantSpeed > 0) { |
| 139 | period = this._getLineLength(symbol) / constantSpeed * 1000; |
| 140 | } |
| 141 | |
| 142 | if (period !== this._period || loop !== this._loop || roundTrip !== this._roundTrip) { |
| 143 | symbol.stopAnimation(); |
| 144 | let delayNum: number; |
| 145 | if (zrUtil.isFunction(delayExpr)) { |
| 146 | delayNum = delayExpr(idx); |
| 147 | } |
| 148 | else { |
| 149 | delayNum = delayExpr; |
| 150 | } |
| 151 | if (symbol.__t > 0) { |
| 152 | delayNum = -period * symbol.__t; |
| 153 | } |
| 154 | |
| 155 | this._animateSymbol( |
| 156 | symbol, period, delayNum, loop, roundTrip |
| 157 | ); |
| 158 | } |
| 159 | |
| 160 | this._period = period; |
| 161 | this._loop = loop; |
| 162 | this._roundTrip = roundTrip; |
| 163 | } |
| 164 | |
| 165 | private _animateSymbol( |
| 166 | symbol: ECSymbolOnEffectLine, period: number, delayNum: number, loop: boolean, roundTrip: boolean) { |
no test coverage detected