import Group from 'zrender/src/container/Group'; import Line from 'zrender/src/graphic/shape/Line'; /** 延时释放*/ export default class ERelease extends Group { constructor(model) { super(); this.model = model; this.isNew = false; } _create() { if (!this.isNew) { const model = this.model; this.isNew = true; this.lines = new Line({ zlevel: model.zlevel, z: model.z, shape: model.shape, progressive: model.progressive, style: { lineWidth: model.lineWidth, stroke: model.stroke } }); this.add(this.lines); } } setStyle(model) { this._create(); this.lines.setStyle(model); } hide() { this._create(); this.lines.hide(); } show() { this._create(); this.lines.show(); } // 开始动画 animateStyle(loop, animates) { this._create(); if (animates && animates.length) { this.eachChild((child) => { if (child.animateStyle) { let an = child.animateStyle(loop); animates.forEach(elem => { an = an.when(elem.time, elem.styles); }); an.start(); } }); } } // 结束动画 stopAnimation(flag) { this._create(); this.eachChild((child) => { if (child.stopAnimation) { child.stopAnimation(flag); } }); } }