rt-sim-training-client/src/jmapNew/shape/Station/EArrow.js
2019-12-05 10:52:45 +08:00

53 lines
1.4 KiB
JavaScript

import Polygon from 'zrender/src/graphic/shape/Polygon';
import Group from 'zrender/src/container/Group';
class ESigAuto extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model;
this.arrow = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: model.point
},
style: {
stroke: model.stroke,
lineWidth: model.lineWidth,
fill: model.fill
}
});
this.add(this.arrow);
}
// 停止动画
animationRecover() {
this.arrow.stopAnimation(false);
}
// 箭头颜色
setColor(color) {
this.arrow.setStyle('fill', color);
}
// 箭头闪烁
arrowsAnimation() {
const style = this.model.style;
const fill = this.arrow.style.Signal.fill;
this.arrow.animateStyle(true)
.when(1000, { fill: style.backgroundColor, stroke: style.backgroundColor })
.when(2000, { fill: fill, stroke: style.Signal.sidelineColor })
.when(3000, { fill: style.backgroundColor, stroke: style.backgroundColor })
.when(4000, { fill: fill, stroke: style.Signal.sidelineColor })
.start();
}
}
export default ESigAuto;