Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
SG5: RichText refuses an at or exitAt past its Sequence's last frame
shinyobjectz0d01e4ef4329
diff --git a/docs/stage-guards.feature b/docs/stage-guards.featureindex b22ccf25..67524684 100644--- a/docs/stage-guards.feature+++ b/docs/stage-guards.feature@@ -127,6 +127,8 @@ Feature: Stage guards: a 3D render an agent can't breakthis composition's last frame (149). Give `at` in this Sequence's frames (useCurrentFrame), or put the scenein a <Sequence from>."And the 3D guide says a scene is a <Sequence>, never a frame passed down as a prop+ # Status 11-21 (branch stage-guards): RichText refuses an `at` or `exitAt` at or past its Sequence's last frame,+ # naming the prop and the fix. clock.ts (the same for the other parts that take a frame) is left.Scenario: SG6. Lines are linesGiven the plandiff --git a/sdk/render/src/3d/text.tsx b/sdk/render/src/3d/text.tsxindex 0a0a780c..4b661a79 100644--- a/sdk/render/src/3d/text.tsx+++ b/sdk/render/src/3d/text.tsx@@ -176,13 +176,19 @@ const utf8 = (c: string) => { const n = c.codePointAt(0)!; return n < 0x80 ? 1 :export function RichText(props: RichTextProps) {const owner = "RichText";const frame = useCurrentFrame();- const { fps } = useVideoConfig();+ const { fps, durationInFrames } = useVideoConfig();const { position = [0, 0, 0], rotation = [0, 0, 0], scale = 1, size = 0.5, align = "center", each = 2, by = "letter", at = 0, exitEach = 0 } = props;checkVec(owner, "position", position);checkVec(owner, "rotation", rotation);if (!(size > 0) || !Number.isFinite(size)) throw new RangeError(`${owner}: size is the em in metres, a positive number, got ${size}`);if (!["left", "center", "right"].includes(align)) throw new RangeError(`${owner}: align is left, center or right, got ${JSON.stringify(align)}`);if (props.exit !== undefined && props.exitAt === undefined) throw new Error(`${owner}: an exit needs exitAt (the local frame it starts)`);+ // one clock (docs/stage-guards.feature SG5): `at` and `exitAt` are frames of this Sequence, as useCurrentFrame counts+ // them. A frame from another clock (a scene's own frame passed down as a prop) can fall past the Sequence's end, where+ // the move never starts: 11-21, a quote whose reveal was set at its scene's frame 1013 never appeared in a 150-frame part+ for (const [k, v] of [["at", props.at], ["exitAt", props.exitAt]] as const) {+ if (v !== undefined && Number.isFinite(durationInFrames) && v >= durationInFrames) throw new RangeError(`${owner}${props.name ? ` '${props.name}'` : ""}: ${k} ${v} is after this Sequence's last frame (${durationInFrames - 1}). Give ${k} in this Sequence's frames (useCurrentFrame), never a frame passed down as a prop, or put the scene in a <Sequence from>.`);+ }const runs = textRuns(owner, props);// the glyphs: every character that isn't a space, with its byte in the joined text (raea-render lays the text out whole)type G = { ch: string; at: number; span: number; color: string; line: number; word: number; inWord: number };