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.

SG7: the manual's raea/camera page lists cameraPath and its types

shinyobjectzf7147d52c078
diff --git a/docs/manual/reference/sdk/camera.md b/docs/manual/reference/sdk/camera.md
index 9507e984..a435bdaa 100644
--- a/docs/manual/reference/sdk/camera.md
+++ b/docs/manual/reference/sdk/camera.md
@@ -19,10 +19,10 @@ const Shot = () => <Camera3d transform={Transform.fromXyz(-2, 2.5, 5).lookingAt(
<!-- generated:begin by tools/manual-ref/sdk.ts from the SDK's exports and doc comments; edit outside this block -->
```ts
-import { Camera3d, Canvas3D, checkMatchmove, Hdr } from "raea/camera"
+import { Camera3d, cameraPath, Canvas3D, checkMatchmove } from "raea/camera"
```
-`raea/camera` exports 5 components, 1 hook, 3 functions, 9 types. Bevy's counterpart: `bevy_camera`. Source: [sdk/raea/src/camera.ts](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/src/camera.ts).
+`raea/camera` exports 5 components, 1 hook, 4 functions, 13 types. Bevy's counterpart: `bevy_camera`. Source: [sdk/raea/src/camera.ts](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/src/camera.ts).
## Components
@@ -97,6 +97,24 @@ function useMatchmove(): MatchmoveState
## Functions
+### `cameraPath`
+
+A camera path through keys timed in frames, paced by time so the camera's speed carries smoothly across every key.
+It eases at the first key and the last, stops at a key with `hold`, and never overshoots a key and comes back.
+
+```tsx
+const path = cameraPath([
+ { at: 0, pos: [0, 2, 9], look: [0, 1, 0] },
+ { at: 60, pos: [3, 2, 6], look: [0, 1, 0], hold: 30 },
+ { at: 150, pos: [1, 1.5, 3], look: [0, 1.2, 0], fov: 30 },
+]);
+<Camera3d {...path.camera(useCurrentFrame())} />
+```
+
+```ts
+function cameraPath(keys: readonly CameraKey[]): CameraPath
+```
+
### `checkMatchmove`
Checks a Matchmove's props; throws a TypeError or RangeError naming the prop.
@@ -128,6 +146,36 @@ function matchmoveView(footage: { width: number; height: number; }, frame: { wid
The props of [`Camera3d`](#camera3d), tabled there.
+### `CameraKey`
+
+A key of a camera path: where the camera is at a frame, and what it looks at.
+
+```ts
+type CameraKey = { /** The frame the camera reaches this key, in the frames of the Sequence it plays in (useCurrentFrame). */ at: number; /** Where the camera is. */ pos: CameraVec3; /** The point it looks at. */ look: CameraVec3; /** Its vertical field of view in degrees. Left out, the key before's (38 at the fi…
+```
+
+### `CameraPath`
+
+A camera path built by cameraPath.
+
+```ts
+type CameraPath = { /** The camera at a frame (a fraction is fine): the first key's before it, the last key's after it. */ at(frame: number): CameraPose; /** Camera3d's props at a frame: its transform, looking at the look point, and its projection (fov in radians, as * Bevy's is; the keys' are degrees). `<Camera3…
+```
+
+### `CameraPose`
+
+Where the camera is at a frame, what it looks at and its vertical field of view in degrees.
+
+```ts
+type CameraPose = { pos: CameraVec3; look: CameraVec3; fov: number }
+```
+
+### `CameraVec3`
+
+```ts
+type CameraVec3 = [number, number, number]
+```
+
### `CameraViewport`
Bevy's Viewport on a Camera, its depth range Bevy's default 0..1.
diff --git a/docs/manual/reference/sdk/index.md b/docs/manual/reference/sdk/index.md
index 651cd7c8..e307d87a 100644
--- a/docs/manual/reference/sdk/index.md
+++ b/docs/manual/reference/sdk/index.md
@@ -70,7 +70,7 @@ Bevy's 3D: cameras, lights, materials, meshes and the frame after it's drawn.
| Import | What it's for | Exports |
| --- | --- | --- |
| [`raea/3d`](3d.md) | raea's scene layer: models, physics, splats, matchmoves, instancing, custom shader passes and 3D text. | 70 components, 4 hooks, 26 functions, 3 classes, 12 values, 126 types |
-| [`raea/camera`](camera.md) | Cameras and the views they make: Camera3d, the Canvas3D a 2D scene draws in, HDR and matchmoved cameras. | 5 components, 1 hook, 3 functions, 9 types |
+| [`raea/camera`](camera.md) | Cameras and the views they make: Camera3d, the Canvas3D a 2D scene draws in, HDR and matchmoved cameras. | 5 components, 1 hook, 4 functions, 13 types |
| [`raea/light`](light.md) | Bevy's lights in Bevy's units, environments, skies and daylight. | 15 components, 9 functions, 2 values, 15 types |
| [`raea/pbr`](pbr.md) | Materials and volumes: StandardMaterial, extended and toon materials, custom shaders, decals, fog and fire. | 22 components, 1 function, 1 value, 35 types |
| [`raea/mesh`](mesh.md) | Shapes and solids: Mesh3d and Mesh2d, Bevy's primitives, buffer meshes, instancing and exact solids. | 14 components, 1 function, 2 classes, 10 values, 24 types |