2019-07-16 16:03:56 +08:00
|
|
|
import Group from 'zrender/src/container/Group';
|
|
|
|
import Line from 'zrender/src/graphic/shape/Line';
|
|
|
|
|
2019-07-22 13:39:33 +08:00
|
|
|
/** 延时释放*/
|
|
|
|
export default class ERelease extends Group {
|
2019-07-16 16:03:56 +08:00
|
|
|
constructor(model) {
|
|
|
|
super();
|
|
|
|
this.model = model;
|
|
|
|
this.zlevel = model.zlevel;
|
|
|
|
this.z = model.z;
|
|
|
|
this._create();
|
|
|
|
}
|
|
|
|
|
|
|
|
_create() {
|
|
|
|
const model = this.model;
|
|
|
|
this.Lines = new Line({
|
|
|
|
zlevel: model.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
shape: model.shape,
|
|
|
|
style: {
|
|
|
|
lineWidth: model.lineWidth,
|
|
|
|
stroke: model.stroke
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.Lines);
|
|
|
|
}
|
|
|
|
|
|
|
|
setStyle(model) {
|
|
|
|
this.Lines.setStyle(model);
|
|
|
|
}
|
|
|
|
|
|
|
|
hide() {
|
|
|
|
this.Lines.hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
show() {
|
|
|
|
this.Lines.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
// 开始动画
|
|
|
|
animateStyle(loop, animates) {
|
|
|
|
if (animates && animates.length) {
|
|
|
|
this.eachChild((child) => {
|
|
|
|
if (child.animateStyle && child.isLine) {
|
|
|
|
let an = child.animateStyle(loop);
|
|
|
|
animates.forEach(elem => {
|
|
|
|
an = an.when(elem.time, elem.styles);
|
|
|
|
});
|
|
|
|
an.start();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 结束动画
|
|
|
|
stopAnimation(flag) {
|
|
|
|
this.eachChild((child) => {
|
|
|
|
if (child.stopAnimation && child.isLine) {
|
|
|
|
child.stopAnimation(flag);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|