fix(npc-dialogue): only dialogue lines type out
Every rendered line went through the reveal, so a choice lead-in typed before its buttons appeared and event, narration and closing lines animated like speech. Only node.type === 'dialogue' types now; the rest land whole. The visible effect beyond the lead-in: choice footers no longer wait on the lead-in, since the footer is gated on the streaming line finishing.
This commit is contained in:
parent
18ea696d1b
commit
36f4bf5e1a
2 changed files with 9 additions and 3 deletions
|
|
@ -281,8 +281,12 @@ export function NpcConversation({
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nothing to animate for an empty line, and a reduced-motion device skips
|
// Nothing to animate for an empty line, and a reduced-motion device skips
|
||||||
// the animation outright.
|
// the animation outright. Only the NPC's spoken lines type: choice lead-ins,
|
||||||
const animate = typewriter && total > 0 && !prefersReducedMotion();
|
// event lines, descriptive narration and end closings are the interface's
|
||||||
|
// own voice, and they land whole so the footer never waits on prose the
|
||||||
|
// player is not being spoken to by.
|
||||||
|
const animate =
|
||||||
|
typewriter && node.type === "dialogue" && total > 0 && !prefersReducedMotion();
|
||||||
// A clip paces the reveal: the text finishes with the read, so the two do
|
// A clip paces the reveal: the text finishes with the read, so the two do
|
||||||
// not drift apart on a long line.
|
// not drift apart on a long line.
|
||||||
const durationMs =
|
const durationMs =
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,9 @@ instead of breaking the line.
|
||||||
|
|
||||||
## Typing animation
|
## Typing animation
|
||||||
|
|
||||||
Lines type themselves out. `DialogueText` takes a `reveal` count and truncates the
|
Only the NPC's spoken lines type (`node.type === "dialogue"`); choice lead-ins,
|
||||||
|
event lines, descriptive narration and end closings land whole, so a choice
|
||||||
|
footer never waits on a lead-in. `DialogueText` takes a `reveal` count and truncates the
|
||||||
**rendered** strings, never the source, so a half-typed line can never show `{gre`
|
**rendered** strings, never the source, so a half-typed line can never show `{gre`
|
||||||
or an unclosed `**`. `visibleLength(text)` is the matching count (markup costs
|
or an unclosed `**`. `visibleLength(text)` is the matching count (markup costs
|
||||||
nothing, an image or countdown costs one) and is what pacing and "is it finished"
|
nothing, an image or countdown costs one) and is what pacing and "is it finished"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue