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.

startFrom, endAt, trimBefore and trimAfter say they count the composition's frames, not the media's own (#89 bug 6): a 24 fps clip in a 60 fps film starts at its 4 s with startFrom={240}. The doc comments and the manual's SDK reference said the media's own frame

shinyobjectzc4f9a8498843
diff --git a/docs/manual/reference/sdk/raea.md b/docs/manual/reference/sdk/raea.md
index 5f470b0a..25616402 100644
--- a/docs/manual/reference/sdk/raea.md
+++ b/docs/manual/reference/sdk/raea.md
@@ -1162,10 +1162,10 @@ The props of [`Loop`](#loop), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `src` (required) | `string` | the file: staticFile("clip.mp4"), or a generated asset |
-| `startFrom` | `number` | the media's own frame it starts playing from (0); the same as trimBefore |
-| `endAt` | `number` | the media's frame it stops before (exclusive): it holds the last frame, or loops; the same as trimAfter |
-| `trimBefore` | `number` | frames of the media cut off its start (the newer name for startFrom) |
-| `trimAfter` | `number` | the media's frame it's cut at (the newer name for endAt) |
+| `startFrom` | `number` | where in the media it starts playing (0), counted in the composition's frames, not the media's own: a 24 fps clip in a 60 fps film starts at its 4 s with startFrom={240}; the same as trimBefore |
+| `endAt` | `number` | where in the media it stops (exclusive), in the composition's frames like startFrom: it holds the last frame, or loops; the same as trimAfter |
+| `trimBefore` | `number` | how much of the media is cut off its start, in the composition's frames (the newer name for startFrom) |
+| `trimAfter` | `number` | where the media is cut, in the composition's frames (the newer name for endAt) |
| `volume` | `VolumeProp` | linear gain, 1 being unity (0.5 is about -6 dB, 1.78 about +5 dB), or a function of the media's own frame |
| `gainDb` | `VolumeProp` | ours: the gain in decibels (or a function of the media's own frame returning it); wins over volume |
| `fadeIn` | `number` | ours: seconds to ramp the sound in from silence at its start (applied by the renderer at the audio's rate) |
diff --git a/docs/manual/reference/sdk/video.md b/docs/manual/reference/sdk/video.md
index e432707b..fd86c1bb 100644
--- a/docs/manual/reference/sdk/video.md
+++ b/docs/manual/reference/sdk/video.md
@@ -111,10 +111,10 @@ The props of [`Loop`](#loop), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `src` (required) | `string` | the file: staticFile("clip.mp4"), or a generated asset |
-| `startFrom` | `number` | the media's own frame it starts playing from (0); the same as trimBefore |
-| `endAt` | `number` | the media's frame it stops before (exclusive): it holds the last frame, or loops; the same as trimAfter |
-| `trimBefore` | `number` | frames of the media cut off its start (the newer name for startFrom) |
-| `trimAfter` | `number` | the media's frame it's cut at (the newer name for endAt) |
+| `startFrom` | `number` | where in the media it starts playing (0), counted in the composition's frames, not the media's own: a 24 fps clip in a 60 fps film starts at its 4 s with startFrom={240}; the same as trimBefore |
+| `endAt` | `number` | where in the media it stops (exclusive), in the composition's frames like startFrom: it holds the last frame, or loops; the same as trimAfter |
+| `trimBefore` | `number` | how much of the media is cut off its start, in the composition's frames (the newer name for startFrom) |
+| `trimAfter` | `number` | where the media is cut, in the composition's frames (the newer name for endAt) |
| `volume` | `VolumeProp` | linear gain, 1 being unity (0.5 is about -6 dB, 1.78 about +5 dB), or a function of the media's own frame |
| `gainDb` | `VolumeProp` | ours: the gain in decibels (or a function of the media's own frame returning it); wins over volume |
| `fadeIn` | `number` | ours: seconds to ramp the sound in from silence at its start (applied by the renderer at the audio's rate) |
diff --git a/sdk/video/src/media.tsx b/sdk/video/src/media.tsx
index f9f38249..48ed4448 100644
--- a/sdk/video/src/media.tsx
+++ b/sdk/video/src/media.tsx
@@ -11,13 +11,15 @@ export type VolumeProp = number | ((mediaFrame: number) => number);
export interface MediaProps {
/** the file: staticFile("clip.mp4"), or a generated asset */
src: string;
- /** the media's own frame it starts playing from (0); the same as trimBefore */
+ /** where in the media it starts playing (0), counted in the composition's frames, not the
+ * media's own: a 24 fps clip in a 60 fps film starts at its 4 s with startFrom={240}; the same as trimBefore */
startFrom?: number;
- /** the media's frame it stops before (exclusive): it holds the last frame, or loops; the same as trimAfter */
+ /** where in the media it stops (exclusive), in the composition's frames like startFrom: it holds the last frame, or
+ * loops; the same as trimAfter */
endAt?: number;
- /** frames of the media cut off its start (the newer name for startFrom) */
+ /** how much of the media is cut off its start, in the composition's frames (the newer name for startFrom) */
trimBefore?: number;
- /** the media's frame it's cut at (the newer name for endAt) */
+ /** where the media is cut, in the composition's frames (the newer name for endAt) */
trimAfter?: number;
/** linear gain, 1 being unity (0.5 is about -6 dB, 1.78 about +5 dB), or a function of the media's own frame */
volume?: VolumeProp;