| 195 | public pause(): void { this._timer.pause() } |
| 196 | |
| 197 | private _render(now: number): void { |
| 198 | // console.log('now ' + now.toFixed(2) + ' duration: ' + this._timer.duration.toFixed(2)) |
| 199 | const frame = this._queue.frame(now) |
| 200 | if (this._lastframe === frame && now > this._lasttime) { |
| 201 | writeSync(this._term, frame.data(now, this._lasttime)) |
| 202 | } else { |
| 203 | this._term.reset() |
| 204 | if (frame.prev) { |
| 205 | writeSync(this._term, frame.prev.snapshot() + frame.data(now)) |
| 206 | } else { |
| 207 | writeSync(this._term, frame.data(now)) |
| 208 | } |
| 209 | } |
| 210 | this._lastframe = frame |
| 211 | this._lasttime = now |
| 212 | |
| 213 | this._onAfterRender.fire() |
| 214 | } |
| 215 | } |