Skip to content

armgit / raea

Public Imported from GitHub
0

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.

Spec: inside a Sequence, useVideoConfig().durationInFrames is the Sequence's length (its own, cut short where its parent's ends; a Loop's children get one pass), as Remotion's public docs for useVideoConfig say, and its conformance test (#126, from #128)

Ragulsundarame3dfcb96d12d
diff --git a/sdk/raea/conformance/timeline.test.tsx b/sdk/raea/conformance/timeline.test.tsx
index 6de06f81..c068d15d 100644
--- a/sdk/raea/conformance/timeline.test.tsx
+++ b/sdk/raea/conformance/timeline.test.tsx
@@ -99,6 +99,17 @@ describe("useVideoConfig and AbsoluteFill", () => {
at(0, <Sequence width={540} height={960}><Read /></Sequence>);
expect(cfg).toMatchObject({ width: 540, height: 960 });
});
+ test("inside a Sequence, durationInFrames is the Sequence's", () => {
+ const d: Record<string, number> = {};
+ function Read({ id }: { id: string }) { d[id] = useVideoConfig().durationInFrames; return null; }
+ at(15, <Sequence from={10} durationInFrames={20}><Read id="own" /></Sequence>);
+ at(15, <Sequence from={10}><Read id="open" /></Sequence>);
+ at(275, <Sequence from={250} durationInFrames={100}><Read id="cut" /></Sequence>);
+ at(45, <Sequence from={30} durationInFrames={40}><Sequence from={5}><Read id="nested" /></Sequence></Sequence>);
+ at(5, <Loop durationInFrames={12}><Read id="loop" /></Loop>);
+ at(5, <Freeze frame={2}><Read id="freeze" /></Freeze>);
+ expect(d).toEqual({ own: 20, open: 290, cut: 50, nested: 35, loop: 12, freeze: 300 });
+ });
test("AbsoluteFill renders its children", () => {
at(3, <AbsoluteFill style={{ background: "black" }}><Probe id="a" /></AbsoluteFill>);
expect(seen.a).toBe(3);
diff --git a/sdk/raea/spec/motion.feature b/sdk/raea/spec/motion.feature
index 53a4f24b..39572af3 100644
--- a/sdk/raea/spec/motion.feature
+++ b/sdk/raea/spec/motion.feature
@@ -21,7 +21,9 @@ Feature: raea, the behaviour of its API
And defaultProps are JSON-like values handed to the component as its props
Scenario: What a component can ask
Then `useVideoConfig()` returns {id, width, height, fps, durationInFrames, defaultProps} of the composition it is
- rendered in (a Sequence given width and height reports those to its children instead)
+ rendered in (a Sequence given width and height reports those to its children instead, and inside a
+ Sequence durationInFrames is the Sequence's: its own, cut short where its parent's ends; a Loop's children
+ get one pass)
And `useCurrentFrame()` returns the frame being rendered, measured from the start of the nearest enclosing
Sequence (the composition's frame outside any Sequence)
Scenario: AbsoluteFill