rt-sim-training-client/src/jmap/shape/Section/ERelease.js

65 lines
1.1 KiB
JavaScript
Raw Normal View History

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,
2019-07-22 17:20:01 +08:00
progressive: model.progressive,
2019-07-16 16:03:56 +08:00
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);
}
});
}
}