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;
|
2019-07-24 14:33:50 +08:00
|
|
|
this.isNew = false;
|
|
|
|
|
2019-07-16 16:03:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
_create() {
|
2019-07-24 14:33:50 +08:00
|
|
|
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);
|
|
|
|
}
|
2019-07-16 16:03:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
setStyle(model) {
|
2019-07-24 14:33:50 +08:00
|
|
|
this._create();
|
|
|
|
this.lines.setStyle(model);
|
2019-07-16 16:03:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
hide() {
|
2019-07-24 14:33:50 +08:00
|
|
|
this._create();
|
|
|
|
this.lines.hide();
|
2019-07-16 16:03:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
show() {
|
2019-07-24 14:33:50 +08:00
|
|
|
this._create();
|
|
|
|
this.lines.show();
|
2019-07-16 16:03:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 开始动画
|
|
|
|
animateStyle(loop, animates) {
|
2019-07-24 14:33:50 +08:00
|
|
|
this._create();
|
2019-07-16 16:03:56 +08:00
|
|
|
if (animates && animates.length) {
|
|
|
|
this.eachChild((child) => {
|
2019-07-24 14:33:50 +08:00
|
|
|
if (child.animateStyle) {
|
2019-07-16 16:03:56 +08:00
|
|
|
let an = child.animateStyle(loop);
|
|
|
|
animates.forEach(elem => {
|
|
|
|
an = an.when(elem.time, elem.styles);
|
|
|
|
});
|
|
|
|
an.start();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 结束动画
|
|
|
|
stopAnimation(flag) {
|
2019-07-24 14:33:50 +08:00
|
|
|
this._create();
|
2019-07-16 16:03:56 +08:00
|
|
|
this.eachChild((child) => {
|
2019-07-24 14:33:50 +08:00
|
|
|
if (child.stopAnimation) {
|
2019-07-16 16:03:56 +08:00
|
|
|
child.stopAnimation(flag);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|