Skip to content

An AI skill that turns books into animated, narrated, interactive web experiences

fix(engine): v2.4.2, a beat's last caption clears after its narration

yzradc12d4694ef
diff --git a/engine/engine.js b/engine/engine.js
index f3e03b6..ea0e600 100644
--- a/engine/engine.js
+++ b/engine/engine.js
@@ -1523,7 +1523,9 @@ function ui() {
// a cue is [start, line], [start, line, end] or [start, line, end, 1]: with an end, the caption clears once its
// words are over; a 1 marks a line in another language, whose subtitle shows even with captions off (as does every
// cue of a beat whose timings say forced: true, from tts.py or eleven.py)
- for (const [t, line, end, forced] of TIMINGS[b.id].cues) {
+ // the last line without an end clears a second after the narration, so it does not sit on a closing title
+ const cues = TIMINGS[b.id].cues;
+ for (const [k, [t, line, end = k === cues.length - 1 ? TIMINGS[b.id].dur + 1 : null, forced]] of cues.entries()) {
if (t + (b.pre || 0) > P.t + .05) break;
text = (captions || forced || TIMINGS[b.id].forced) && !(end != null && P.t > end + (b.pre || 0)) ? line : '';
}
diff --git a/site/elementary-algebra/lib/engine.js b/site/elementary-algebra/lib/engine.js
index f3e03b6..ea0e600 100644
--- a/site/elementary-algebra/lib/engine.js
+++ b/site/elementary-algebra/lib/engine.js
@@ -1523,7 +1523,9 @@ function ui() {
// a cue is [start, line], [start, line, end] or [start, line, end, 1]: with an end, the caption clears once its
// words are over; a 1 marks a line in another language, whose subtitle shows even with captions off (as does every
// cue of a beat whose timings say forced: true, from tts.py or eleven.py)
- for (const [t, line, end, forced] of TIMINGS[b.id].cues) {
+ // the last line without an end clears a second after the narration, so it does not sit on a closing title
+ const cues = TIMINGS[b.id].cues;
+ for (const [k, [t, line, end = k === cues.length - 1 ? TIMINGS[b.id].dur + 1 : null, forced]] of cues.entries()) {
if (t + (b.pre || 0) > P.t + .05) break;
text = (captions || forced || TIMINGS[b.id].forced) && !(end != null && P.t > end + (b.pre || 0)) ? line : '';
}
diff --git a/site/joke-collection/lib/engine.js b/site/joke-collection/lib/engine.js
index f3e03b6..ea0e600 100644
--- a/site/joke-collection/lib/engine.js
+++ b/site/joke-collection/lib/engine.js
@@ -1523,7 +1523,9 @@ function ui() {
// a cue is [start, line], [start, line, end] or [start, line, end, 1]: with an end, the caption clears once its
// words are over; a 1 marks a line in another language, whose subtitle shows even with captions off (as does every
// cue of a beat whose timings say forced: true, from tts.py or eleven.py)
- for (const [t, line, end, forced] of TIMINGS[b.id].cues) {
+ // the last line without an end clears a second after the narration, so it does not sit on a closing title
+ const cues = TIMINGS[b.id].cues;
+ for (const [k, [t, line, end = k === cues.length - 1 ? TIMINGS[b.id].dur + 1 : null, forced]] of cues.entries()) {
if (t + (b.pre || 0) > P.t + .05) break;
text = (captions || forced || TIMINGS[b.id].forced) && !(end != null && P.t > end + (b.pre || 0)) ? line : '';
}
diff --git a/site/little-red-riding-hood/lib/engine.js b/site/little-red-riding-hood/lib/engine.js
index f3e03b6..ea0e600 100644
--- a/site/little-red-riding-hood/lib/engine.js
+++ b/site/little-red-riding-hood/lib/engine.js
@@ -1523,7 +1523,9 @@ function ui() {
// a cue is [start, line], [start, line, end] or [start, line, end, 1]: with an end, the caption clears once its
// words are over; a 1 marks a line in another language, whose subtitle shows even with captions off (as does every
// cue of a beat whose timings say forced: true, from tts.py or eleven.py)
- for (const [t, line, end, forced] of TIMINGS[b.id].cues) {
+ // the last line without an end clears a second after the narration, so it does not sit on a closing title
+ const cues = TIMINGS[b.id].cues;
+ for (const [k, [t, line, end = k === cues.length - 1 ? TIMINGS[b.id].dur + 1 : null, forced]] of cues.entries()) {
if (t + (b.pre || 0) > P.t + .05) break;
text = (captions || forced || TIMINGS[b.id].forced) && !(end != null && P.t > end + (b.pre || 0)) ? line : '';
}
diff --git a/site/madness-shorts/lib/engine.js b/site/madness-shorts/lib/engine.js
index f3e03b6..ea0e600 100644
--- a/site/madness-shorts/lib/engine.js
+++ b/site/madness-shorts/lib/engine.js
@@ -1523,7 +1523,9 @@ function ui() {
// a cue is [start, line], [start, line, end] or [start, line, end, 1]: with an end, the caption clears once its
// words are over; a 1 marks a line in another language, whose subtitle shows even with captions off (as does every
// cue of a beat whose timings say forced: true, from tts.py or eleven.py)
- for (const [t, line, end, forced] of TIMINGS[b.id].cues) {
+ // the last line without an end clears a second after the narration, so it does not sit on a closing title
+ const cues = TIMINGS[b.id].cues;
+ for (const [k, [t, line, end = k === cues.length - 1 ? TIMINGS[b.id].dur + 1 : null, forced]] of cues.entries()) {
if (t + (b.pre || 0) > P.t + .05) break;
text = (captions || forced || TIMINGS[b.id].forced) && !(end != null && P.t > end + (b.pre || 0)) ? line : '';
}
diff --git a/site/madness/lib/engine.js b/site/madness/lib/engine.js
index f3e03b6..ea0e600 100644
--- a/site/madness/lib/engine.js
+++ b/site/madness/lib/engine.js
@@ -1523,7 +1523,9 @@ function ui() {
// a cue is [start, line], [start, line, end] or [start, line, end, 1]: with an end, the caption clears once its
// words are over; a 1 marks a line in another language, whose subtitle shows even with captions off (as does every
// cue of a beat whose timings say forced: true, from tts.py or eleven.py)
- for (const [t, line, end, forced] of TIMINGS[b.id].cues) {
+ // the last line without an end clears a second after the narration, so it does not sit on a closing title
+ const cues = TIMINGS[b.id].cues;
+ for (const [k, [t, line, end = k === cues.length - 1 ? TIMINGS[b.id].dur + 1 : null, forced]] of cues.entries()) {
if (t + (b.pre || 0) > P.t + .05) break;
text = (captions || forced || TIMINGS[b.id].forced) && !(end != null && P.t > end + (b.pre || 0)) ? line : '';
}
diff --git a/site/math-notebook/lib/engine.js b/site/math-notebook/lib/engine.js
index f3e03b6..ea0e600 100644
--- a/site/math-notebook/lib/engine.js
+++ b/site/math-notebook/lib/engine.js
@@ -1523,7 +1523,9 @@ function ui() {
// a cue is [start, line], [start, line, end] or [start, line, end, 1]: with an end, the caption clears once its
// words are over; a 1 marks a line in another language, whose subtitle shows even with captions off (as does every
// cue of a beat whose timings say forced: true, from tts.py or eleven.py)
- for (const [t, line, end, forced] of TIMINGS[b.id].cues) {
+ // the last line without an end clears a second after the narration, so it does not sit on a closing title
+ const cues = TIMINGS[b.id].cues;
+ for (const [k, [t, line, end = k === cues.length - 1 ? TIMINGS[b.id].dur + 1 : null, forced]] of cues.entries()) {
if (t + (b.pre || 0) > P.t + .05) break;
text = (captions || forced || TIMINGS[b.id].forced) && !(end != null && P.t > end + (b.pre || 0)) ? line : '';
}
diff --git a/site/physics-notebook/lib/engine.js b/site/physics-notebook/lib/engine.js
index f3e03b6..ea0e600 100644
--- a/site/physics-notebook/lib/engine.js
+++ b/site/physics-notebook/lib/engine.js
@@ -1523,7 +1523,9 @@ function ui() {
// a cue is [start, line], [start, line, end] or [start, line, end, 1]: with an end, the caption clears once its
// words are over; a 1 marks a line in another language, whose subtitle shows even with captions off (as does every
// cue of a beat whose timings say forced: true, from tts.py or eleven.py)
- for (const [t, line, end, forced] of TIMINGS[b.id].cues) {
+ // the last line without an end clears a second after the narration, so it does not sit on a closing title
+ const cues = TIMINGS[b.id].cues;
+ for (const [k, [t, line, end = k === cues.length - 1 ? TIMINGS[b.id].dur + 1 : null, forced]] of cues.entries()) {
if (t + (b.pre || 0) > P.t + .05) break;
text = (captions || forced || TIMINGS[b.id].forced) && !(end != null && P.t > end + (b.pre || 0)) ? line : '';
}
diff --git a/site/science/lib/engine.js b/site/science/lib/engine.js
index f3e03b6..ea0e600 100644
--- a/site/science/lib/engine.js
+++ b/site/science/lib/engine.js
@@ -1523,7 +1523,9 @@ function ui() {
// a cue is [start, line], [start, line, end] or [start, line, end, 1]: with an end, the caption clears once its
// words are over; a 1 marks a line in another language, whose subtitle shows even with captions off (as does every
// cue of a beat whose timings say forced: true, from tts.py or eleven.py)
- for (const [t, line, end, forced] of TIMINGS[b.id].cues) {
+ // the last line without an end clears a second after the narration, so it does not sit on a closing title
+ const cues = TIMINGS[b.id].cues;
+ for (const [k, [t, line, end = k === cues.length - 1 ? TIMINGS[b.id].dur + 1 : null, forced]] of cues.entries()) {
if (t + (b.pre || 0) > P.t + .05) break;
text = (captions || forced || TIMINGS[b.id].forced) && !(end != null && P.t > end + (b.pre || 0)) ? line : '';
}
diff --git a/site/shooting-an-elephant/lib/engine.js b/site/shooting-an-elephant/lib/engine.js
index f3e03b6..ea0e600 100644
--- a/site/shooting-an-elephant/lib/engine.js
+++ b/site/shooting-an-elephant/lib/engine.js
@@ -1523,7 +1523,9 @@ function ui() {
// a cue is [start, line], [start, line, end] or [start, line, end, 1]: with an end, the caption clears once its
// words are over; a 1 marks a line in another language, whose subtitle shows even with captions off (as does every
// cue of a beat whose timings say forced: true, from tts.py or eleven.py)
- for (const [t, line, end, forced] of TIMINGS[b.id].cues) {
+ // the last line without an end clears a second after the narration, so it does not sit on a closing title
+ const cues = TIMINGS[b.id].cues;
+ for (const [k, [t, line, end = k === cues.length - 1 ? TIMINGS[b.id].dur + 1 : null, forced]] of cues.entries()) {
if (t + (b.pre || 0) > P.t + .05) break;
text = (captions || forced || TIMINGS[b.id].forced) && !(end != null && P.t > end + (b.pre || 0)) ? line : '';
}
diff --git a/site/three-little-pigs/lib/engine.js b/site/three-little-pigs/lib/engine.js
index f3e03b6..ea0e600 100644
--- a/site/three-little-pigs/lib/engine.js
+++ b/site/three-little-pigs/lib/engine.js
@@ -1523,7 +1523,9 @@ function ui() {
// a cue is [start, line], [start, line, end] or [start, line, end, 1]: with an end, the caption clears once its
// words are over; a 1 marks a line in another language, whose subtitle shows even with captions off (as does every
// cue of a beat whose timings say forced: true, from tts.py or eleven.py)
- for (const [t, line, end, forced] of TIMINGS[b.id].cues) {
+ // the last line without an end clears a second after the narration, so it does not sit on a closing title
+ const cues = TIMINGS[b.id].cues;
+ for (const [k, [t, line, end = k === cues.length - 1 ? TIMINGS[b.id].dur + 1 : null, forced]] of cues.entries()) {
if (t + (b.pre || 0) > P.t + .05) break;
text = (captions || forced || TIMINGS[b.id].forced) && !(end != null && P.t > end + (b.pre || 0)) ? line : '';
}