in src/Wshoot/shoot.ts [294:349]
s = function (t: number) {
if (fCo) {
// 出发:
// 1. 出现
if (t < fromTime) {
self.from(fCo, fr, color)(t / fromTime);
// 2. 停留
} else if (t > fromTime && t < fromFadeBegin) {
self.from(fCo, fr, color)(1);
// 3. 消失
} else if (t > fromFadeBegin) {
self.from(fCo, fr, color, true)((t - fromFadeBegin) / fromFade);
}
}
if (tCo) {
// 轨迹
if (t >= fromTime && t < toBegin) {
// 出发 - 到达瞬间
self.track(fCo, tCo, false, color, h)((t - fromTime) / (toBegin - fromTime));
} else if (t > toBegin && t < toFadeBegin) {
// 到达后停留
// TODO add by kaihong.tkh
if (shootDurable) {
let time = -(t - fromTime) / (toBegin - fromTime);
time -= Math.floor(time);
time = 1 - time;
self.track(fCo, tCo, true, color, h)(time);
} else {
self.track(fCo, tCo, true, color, h)(0);
}
} else if (t > toFadeBegin && t < toFadeBegin + toFade) {
// 停留后消失时间
self.track(fCo, tCo, true, color, h)((t - toFadeBegin) / toFade);
}
// 如果不是正在被射击
if (!s.shooting) {
// 到达:
// 1. 放大
if (t >= toBegin && t < (toBegin + toTime)) {
if (!s.to) {
s.to = true;
}
self.to(tCo, tr, color)((t - toBegin) / toTime);
// 2. 停留
} else if (t > (toBegin + toTime) && t < toFadeBegin) {
self.to(tCo, tr, color)(1);
// 3. 消失
} else if (t >= toFadeBegin) {
self.to(tCo, tr, color, true, 3)((t - toFadeBegin) / toFade);
}
}
}
};