(time)
| 59 | } |
| 60 | |
| 61 | step(time) { |
| 62 | var easing = new AEasing(); |
| 63 | var percent = (time - this._startTime) / this._life; |
| 64 | |
| 65 | // 还没开始 |
| 66 | if (percent < 0) { |
| 67 | return; |
| 68 | } |
| 69 | |
| 70 | percent = Math.min(percent, 1); |
| 71 | |
| 72 | var easingFunc = typeof this.easing == 'string' |
| 73 | ? easing[this.easing] |
| 74 | : this.easing; |
| 75 | var schedule = typeof easingFunc === 'function' |
| 76 | ? easingFunc(percent) |
| 77 | : percent; |
| 78 | |
| 79 | this.fire('frame', schedule); |
| 80 | |
| 81 | // 结束 |
| 82 | if (percent == 1) { |
| 83 | if (this.loop) { |
| 84 | this.restart(); |
| 85 | // 重新开始周期 |
| 86 | // 抛出而不是直接调用事件直到 stage.update 后再统一调用这些事件 |
| 87 | return 'restart'; |
| 88 | |
| 89 | } |
| 90 | |
| 91 | // 动画完成将这个控制器标识为待删除 |
| 92 | // 在Animation.update中进行批量删除 |
| 93 | this._needsRemove = true; |
| 94 | return 'destroy'; |
| 95 | } |
| 96 | |
| 97 | return null; |
| 98 | } |
| 99 | |
| 100 | restart() { |
| 101 | var time = new Date().getTime(); |
no test coverage detected