MCPcopy Create free account
hub / github.com/SpringRoll/SpringRoll / updateState

Method updateState

src/localization/captions/Caption.js:72–90  ·  view source on GitHub ↗

* Handles calling callbacks and updating caption's current state. * @param {Number} currentTime * @param {Number} lastTime * @memberof Caption

(currentTime, lastTime)

Source from the content-addressed store, hash-verified

70 * @memberof Caption
71 */
72 updateState(currentTime, lastTime) {
73 if (this.isFinished()) {
74 return;
75 }
76 if (currentTime > this.lines[this.lineIndex].endTime) {
77 this.renderer.lineEnd();
78 }
79 while (currentTime > this.lines[this.lineIndex].endTime) {
80 if ((this.lineIndex++, this.isFinished())) {
81 return;
82 }
83 }
84
85 const line = this.lines[this.lineIndex];
86 if (currentTime >= line.startTime && lastTime <= line.startTime) {
87 this.renderer.lineBegin(line);
88 return;
89 }
90 }
91
92 /**
93 * Checks if caption has completed.

Callers 2

updateMethod · 0.95
startMethod · 0.95

Calls 3

isFinishedMethod · 0.95
lineEndMethod · 0.45
lineBeginMethod · 0.45

Tested by

no test coverage detected