Docs: every SDK prop, field and member described on raea.io/docs, and the reference check fails on a missing one

The SDK reference's tables had 1,476 empty cells. Each prop, field and class member the pages table now has a doc
comment in its source, or Bevy's own field doc where the SDK mirrors a Bevy type:

- doc comments on 773 declarations across 84 SDK files (song maps, goo and rigid bodies, matchmove, the clock and
  timeline, state machines, materials and their extensions, the 2D shapes, bevy_ui and feathers wrappers, colours)
- inline prop types pulled out as named, documented interfaces (EchoesProps, DaylightProps, UiScaleProps, ...), so
  each prop can carry its own doc
- types raea-bevy-sdk generates from raea's crates (/** raea_core_animate::spec::AnimKey */) take their field docs
  from the Rust source, shown as raea's ("Rust: ..."), not Bevy's; core/animate's spec.rs gains the missing ///
- a props type (StandardMaterialProps) takes its component's @bevy fields; the colour classes gain their @bevy tags
- tools/manual-ref/sdk.ts check now fails on any prop, field or member without a description, as cli.ts does for
  flags; tools/manual-ref.sh links an export's node_modules (RAEA_MODULES) so it can run in L1's lane export
This commit is contained in:
shinyobjectz committed 2026-11-08 20:18:08 -08:00
1 parent 2881f190bb
commit 668ae2eb08
123 files changed
+7424 -2062

No files matched your search

+6
View File
@@ -33,6 +33,7 @@ pub struct Animation {
pub freeze: Option<f64>,
/// the frames per second its frames count; springs measure their settle time with it (0: the clock's)
pub fps: f64,
/// the element's keyframed properties, one track each
pub tracks: Vec<AnimTrack>,
/// the local frame it's shown from, when it shows only for a window (mount="during"); before it, display none
pub show_from: Option<f64>,
@@ -45,7 +46,9 @@ pub struct Animation {
#[cfg_attr(feature = "bevy", derive(bevy::prelude::Reflect), reflect(Default))]
#[serde(default)]
pub struct AnimTrack {
/// the property it keys: opacity, x, y, z, scale, rotate, width, height, blur, clip, a colour, `text`, or another number
pub prop: String,
/// its keyframes in frame order
pub keys: Vec<AnimKey>,
/// a length's unit: "px" (when empty) or "%"
pub unit: String,
@@ -55,6 +58,7 @@ pub struct AnimTrack {
pub digits: u32,
/// written before and after a `text` number (a counter's "$" and " pts")
pub prefix: String,
/// written after a `text` number
pub suffix: String,
/// between a `text` number's thousands ("," writes 12,345); empty: none
pub separator: String,
@@ -65,7 +69,9 @@ pub struct AnimTrack {
#[cfg_attr(feature = "bevy", derive(bevy::prelude::Reflect), reflect(Default))]
#[serde(default)]
pub struct AnimKey {
/// the local frame it's at
pub at: f64,
/// a number property's value there
pub value: f64,
/// a colour property's value (CSS text); empty for numbers
pub color: String,
File diff suppressed because it is too large. Load diff
+46 -40
View File
@@ -315,12 +315,12 @@ The named moves by name, as `enter="rise"` finds them.
| `at` | `number` | local frame the entrance starts (0) |
| `exitAt` | `number` | local frame the exit starts |
| `timeline` | `Plan` | a timeline's plan and this element's part in it: the part's move, at its start (plus `at`) |
| `part` | `string` | – |
| `part` | `string` | the part in \`timeline\` whose move this element plays |
| `mount` | `"during" \| "always"` | "always" (default): in the tree, and its layout, the whole time (invisible before an entrance that fades in); "during": only from the entrance's start until the exit ends (it takes its space when it arrives) |
| `as` | `string` | the element: "div" by default |
| `style` | `CSSProperties` | – |
| `className` | `string` | – |
| `children` | `ReactNode` | – |
| `style` | `CSSProperties` | inline style |
| `className` | `string` | Tailwind or CSS classes |
| `children` | `ReactNode` | what moves |
### `AnimateProps`
@@ -330,16 +330,18 @@ type AnimateProps = AnimateOwnProps & { [attr: string]: unknown }
### `Animation`
raea_core_animate::spec::Animation
One element's declared animation.
Rust: `raea_core_animate::spec::Animation`.
| Field | Type | What it is |
| --- | --- | --- |
| `origin` (required) | `number` | – |
| `freeze` (required) | `number \| null` | – |
| `fps` (required) | `number` | – |
| `tracks` (required) | `(AnimTrack)[]` | – |
| `show_from` (required) | `number \| null` | – |
| `show_until` (required) | `number \| null` | – |
| `origin` (required) | `number` | the composition frame the element's local frame 0 falls on (where its Sequence starts) |
| `freeze` (required) | `number \| null` | a local frame to hold at whatever the composition's frame (inside a Freeze) |
| `fps` (required) | `number` | the frames per second its frames count; springs measure their settle time with it (0: the clock's) |
| `tracks` (required) | `(AnimTrack)[]` | the element's keyframed properties, one track each |
| `show_from` (required) | `number \| null` | the local frame it's shown from, when it shows only for a window (mount="during"); before it, display none |
| `show_until` (required) | `number \| null` | the local frame it's hidden from again |
### `AnimGraphNode`
@@ -351,29 +353,33 @@ type AnimGraphNode = | { clip: string | number; time?: number; weight?: number;
### `AnimKey`
raea_core_animate::spec::AnimKey
One key: a value at a local frame, and the curve from it to the next key.
Rust: `raea_core_animate::spec::AnimKey`.
| Field | Type | What it is |
| --- | --- | --- |
| `at` (required) | `number` | – |
| `value` (required) | `number` | – |
| `color` (required) | `string` | – |
| `ease` (required) | `string` | – |
| `at` (required) | `number` | the local frame it's at |
| `value` (required) | `number` | a number property's value there |
| `color` (required) | `string` | a colour property's value (CSS text); empty for numbers |
| `ease` (required) | `string` | the curve to the next key (easing::Easing::parse); empty is linear |
### `AnimTrack`
raea_core_animate::spec::AnimTrack
Keyframes on one property.
Rust: `raea_core_animate::spec::AnimTrack`.
| Field | Type | What it is |
| --- | --- | --- |
| `prop` (required) | `string` | – |
| `keys` (required) | `(AnimKey)[]` | – |
| `unit` (required) | `string` | – |
| `repeat` (required) | `string` | – |
| `digits` (required) | `number` | – |
| `prefix` (required) | `string` | – |
| `suffix` (required) | `string` | – |
| `separator` (required) | `string` | – |
| `prop` (required) | `string` | the property it keys: opacity, x, y, z, scale, rotate, width, height, blur, clip, a colour, `text`, or another number |
| `keys` (required) | `(AnimKey)[]` | its keyframes in frame order |
| `unit` (required) | `string` | a length's unit: "px" (when empty) or "%" |
| `repeat` (required) | `string` | past the last key: "" or "hold", "loop", "pingpong" (for ever), or "loop:N" / "pingpong:N" |
| `digits` (required) | `number` | decimals a `text` number is written with |
| `prefix` (required) | `string` | written before and after a `text` number (a counter's "$" and " pts") |
| `suffix` (required) | `string` | written after a `text` number |
| `separator` (required) | `string` | between a `text` number's thousands ("," writes 12,345); empty: none |
### `Curve`
@@ -400,8 +406,8 @@ type GridFrom = "top-left" | "top-right" | "bottom-left" | "bottom-right" | "cen
| Field | Type | What it is |
| --- | --- | --- |
| `kind` (required) | `"sequence" \| "parallel"` | – |
| `steps` (required) | `Step[]` | – |
| `kind` (required) | `"sequence" \| "parallel"` | sequence: one after another; parallel: together |
| `steps` (required) | `Step[]` | its steps, in order |
| `gap` (required) | `number` | frames between steps of a sequence (negative overlaps) |
### `Keys`
@@ -419,7 +425,7 @@ Tracks by property, in frames from the move's own start.
| Field | Type | What it is |
| --- | --- | --- |
| `tracks` (required) | `Record<string, TrackSpec \| TrackSpec[]>` | – |
| `tracks` (required) | `Record<string, TrackSpec \| TrackSpec[]>` | keyframes by property, in frames from the move's start |
| `frames` (required) | `number` | how long it runs (its last key) |
### `MoveLike`
@@ -440,8 +446,8 @@ A timeline's plan: each part's start frame and move, and the whole length.
| Field | Type | What it is |
| --- | --- | --- |
| `parts` (required) | `Record<string, { at: number; move: Move }>` | – |
| `frames` (required) | `number` | – |
| `parts` (required) | `Record<string, { at: number; move: Move }>` | each part's start frame and move, by its name |
| `frames` (required) | `number` | the whole timeline's length in frames |
### `StaggerProps`
@@ -450,16 +456,16 @@ A timeline's plan: each part's start frame and move, and the whole length.
| `each` (required) | `number` | frames between one child's entrance and the next |
| `grid` | `{ cols: number; rows?: number; from?: GridFrom }` | spread by grid distance instead of order |
| `exitEach` | `number` | the exit staggered too, `exitEach` frames apart (0: all together) |
| `style` | `CSSProperties` | – |
| `style` | `CSSProperties` | inline style |
| `animate` | `Record<string, TrackSpec \| TrackSpec[] \| Keys> \| Move` | free tracks by property, in local frames: `{ backgroundColor: track({ 0: "#fff", 20: "#000" }) }` |
| `as` | `string` | the element: "div" by default |
| `exit` | `MoveLike` | the exit, played at `exitAt` (an entrance reversed: `exit="rise"` sinks back out) |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | what moves |
| `enter` | `MoveLike` | the entrance: a move's name, a move, or several together |
| `at` | `number` | local frame the entrance starts (0) |
| `exitAt` | `number` | local frame the exit starts |
| `mount` | `"during" \| "always"` | "always" (default): in the tree, and its layout, the whole time (invisible before an entrance that fades in); "during": only from the entrance's start until the exit ends (it takes its space when it arrives) |
| `className` | `string` | – |
| `className` | `string` | Tailwind or CSS classes |
### `Step`
@@ -475,13 +481,13 @@ One property's keyframes: values by frame, the curve between each pair (one for
| Field | Type | What it is |
| --- | --- | --- |
| `keys` (required) | `[number, V][]` | – |
| `ease` (required) | `Curve \| Curve[]` | – |
| `unit` | `"px" \| "%"` | – |
| `repeat` | `"hold" \| "loop" \| "pingpong" \| `${"loop" \| "pingpong"}:${number}`` | – |
| `digits` | `number` | – |
| `keys` (required) | `[number, V][]` | [frame, value] pairs in frame order, frames from the move's start |
| `ease` (required) | `Curve \| Curve[]` | the curve between keys: one for all, or one a segment |
| `unit` | `"px" \| "%"` | a length's unit: px (the default) or % |
| `repeat` | `"hold" \| "loop" \| "pingpong" \| `${"loop" \| "pingpong"}:${number}`` | past the last key: hold (the default), loop or pingpong, for ever or N times ("loop:3") |
| `digits` | `number` | decimals a `text` counter writes |
| `prefix` | `string` | a `text` counter's text before and after the number, and between its thousands ("," writes 12,345) |
| `suffix` | `string` | – |
| `separator` | `string` | – |
| `suffix` | `string` | written after a `text` counter's number (" pts") |
| `separator` | `string` | between a `text` counter's thousands ("," writes 12,345) |
<!-- generated:end -->
+36 -38
View File
@@ -42,13 +42,13 @@ Declares a composition inside the root. It draws nothing itself; a renderer find
| Prop | Type | What it does |
| --- | --- | --- |
| `id` (required) | `string` | – |
| `component` (required) | `ComponentType<P>` | – |
| `width` (required) | `number` | – |
| `height` (required) | `number` | – |
| `fps` (required) | `number` | – |
| `durationInFrames` (required) | `number` | – |
| `defaultProps` | `P` | – |
| `id` (required) | `string` | the composition's id: letters, digits and dashes (`raea render --composition` picks it) |
| `component` (required) | `ComponentType<P>` | the React component it renders |
| `width` (required) | `number` | in px |
| `height` (required) | `number` | in px |
| `fps` (required) | `number` | frames a second |
| `durationInFrames` (required) | `number` | its length in frames |
| `defaultProps` | `P` | the props it's rendered with (JSON-like values only) |
| `edit` | `Edit` | a hand edit laid over the composition (docs/craft-system.md, L): written back by the app's timeline |
## Functions
@@ -94,11 +94,10 @@ insert, query and step it, and add TypeScript systems to its schedules.
| Member | What it does |
| --- | --- |
| `new App(id: number, methods: string[])` | – |
| `App.open(o: OpenOptions): BevyApp` | A headless App with these plugins; Startup has run, no frame has stepped. TypeScript plugins are built in order once the App is open, then finished and cleaned up; their Startup systems run before the first frame. |
| `App.stepTogether(apps: BevyApp[], frames?: number): number[]` | Apps stepped together, a frame at a time: a network's peers. Returns each one's frame. |
| `.methods: string[]` | the methods this App answers (BRP's, raea's and its plugins') |
| `.id: number` | – |
| `.id: number` | the App's handle in the engine |
| `.isPluginAdded(name: string): boolean` | Whether a plugin of this name is in the App (Bevy's is_plugin_added), Rust or TypeScript. |
| `.addPlugins(...refs: PluginRef[]): BevyApp` | Adds TypeScript plugins and groups (Bevy's add_plugins): each built in order, then each finished, then each cleaned up. A Rust plugin is compiled in and must be named when the App opens; naming a new one here throws. |
| `.addSystems(schedule: string, systems: ((app: BevyApp, frame: number) => void) \| ((app: BevyApp, frame: number) => void)[], o?: SystemOptions): BevyApp` | Systems in a schedule (Bevy's add_systems), each as `system` adds one; one of the startup schedules (PreStartup, Startup, PostStartup) runs them once, before the App's next frame. Returns the App, to chain. |
@@ -111,11 +110,11 @@ insert, query and step it, and add TypeScript systems to its schedules.
| `.frameSchedules(): string[]` | The schedules a frame runs, in order (Bevy's MainScheduleOrder). |
| `.call<A = unknown>(method: string, params?: unknown): A` | Any method of the App's table, run now: its answer, or a throw with the method's message. |
| `.spawn(...components: With[]): number` | A new entity with these components. |
| `.insert(entity: number, ...components: With[]): void` | – |
| `.insert(entity: number, ...components: With[]): void` | Adds these components to an entity, replacing any it has of the same type. |
| `.get<T>(entity: number, c: Component<T>): T \| undefined` | One component of an entity, or undefined when it hasn't got one. |
| `.query(o: { data?: Component<unknown>[] \| undefined; has?: Component<unknown>[] \| undefined; without?: Component<unknown>[] \| undefined; }): { entity: number…` | Entities with every component in `has` (and none in `without`), with the `data` components' values. |
| `.resource<T>(r: Resource<T>): T` | – |
| `.setResource<T>(r: Resource<T>, value: T): void` | – |
| `.resource<T>(r: Resource<T>): T` | A resource's value. |
| `.setResource<T>(r: Resource<T>, value: T): void` | Sets a resource's value, adding it if the app hasn't got one. |
| `.trigger<T>(e: Event<T>, value: T): void` | Triggers an event: its observers run now. |
| `.write<T>(m: Message<T>, value: T): void` | Writes a message, for its readers' next run. |
| `.observe<T>(e: Event<T>, entity?: number \| undefined): () => T[]` | Starts observing an event (BRP's world.observe+watch). Each call of the returned function gives the events triggered since the last call, in order. `entity` limits it to events aimed at that entity. |
@@ -124,7 +123,7 @@ insert, query and step it, and add TypeScript systems to its schedules.
| `.state<T>(s: State<T>): T \| null` | A state's value (null before it exists). |
| `.setState<T>(s: State<T>, value: T): void` | A state's next value: it changes at the next frame's StateTransition. |
| `.schema(crates?: string[] \| undefined): Record<string, unknown>` | The App's registered types as JSON schema (BRP's registry.schema), filtered by crate. |
| `.close(): void` | – |
| `.close(): void` | Shuts the app down; its methods fail after. |
### `BevyApp`
@@ -133,11 +132,10 @@ insert, query and step it, and add TypeScript systems to its schedules.
| Member | What it does |
| --- | --- |
| `new BevyApp(id: number, methods: string[])` | – |
| `BevyApp.open(o: OpenOptions): BevyApp` | A headless App with these plugins; Startup has run, no frame has stepped. TypeScript plugins are built in order once the App is open, then finished and cleaned up; their Startup systems run before the first frame. |
| `BevyApp.stepTogether(apps: BevyApp[], frames?: number): number[]` | Apps stepped together, a frame at a time: a network's peers. Returns each one's frame. |
| `.methods: string[]` | the methods this App answers (BRP's, raea's and its plugins') |
| `.id: number` | – |
| `.id: number` | the App's handle in the engine |
| `.isPluginAdded(name: string): boolean` | Whether a plugin of this name is in the App (Bevy's is_plugin_added), Rust or TypeScript. |
| `.addPlugins(...refs: PluginRef[]): BevyApp` | Adds TypeScript plugins and groups (Bevy's add_plugins): each built in order, then each finished, then each cleaned up. A Rust plugin is compiled in and must be named when the App opens; naming a new one here throws. |
| `.addSystems(schedule: string, systems: ((app: BevyApp, frame: number) => void) \| ((app: BevyApp, frame: number) => void)[], o?: SystemOptions): BevyApp` | Systems in a schedule (Bevy's add_systems), each as `system` adds one; one of the startup schedules (PreStartup, Startup, PostStartup) runs them once, before the App's next frame. Returns the App, to chain. |
@@ -150,11 +148,11 @@ insert, query and step it, and add TypeScript systems to its schedules.
| `.frameSchedules(): string[]` | The schedules a frame runs, in order (Bevy's MainScheduleOrder). |
| `.call<A = unknown>(method: string, params?: unknown): A` | Any method of the App's table, run now: its answer, or a throw with the method's message. |
| `.spawn(...components: With[]): number` | A new entity with these components. |
| `.insert(entity: number, ...components: With[]): void` | – |
| `.insert(entity: number, ...components: With[]): void` | Adds these components to an entity, replacing any it has of the same type. |
| `.get<T>(entity: number, c: Component<T>): T \| undefined` | One component of an entity, or undefined when it hasn't got one. |
| `.query(o: { data?: Component<unknown>[] \| undefined; has?: Component<unknown>[] \| undefined; without?: Component<unknown>[] \| undefined; }): { entity: number…` | Entities with every component in `has` (and none in `without`), with the `data` components' values. |
| `.resource<T>(r: Resource<T>): T` | – |
| `.setResource<T>(r: Resource<T>, value: T): void` | – |
| `.resource<T>(r: Resource<T>): T` | A resource's value. |
| `.setResource<T>(r: Resource<T>, value: T): void` | Sets a resource's value, adding it if the app hasn't got one. |
| `.trigger<T>(e: Event<T>, value: T): void` | Triggers an event: its observers run now. |
| `.write<T>(m: Message<T>, value: T): void` | Writes a message, for its readers' next run. |
| `.observe<T>(e: Event<T>, entity?: number \| undefined): () => T[]` | Starts observing an event (BRP's world.observe+watch). Each call of the returned function gives the events triggered since the last call, in order. `entity` limits it to events aimed at that entity. |
@@ -163,7 +161,7 @@ insert, query and step it, and add TypeScript systems to its schedules.
| `.state<T>(s: State<T>): T \| null` | A state's value (null before it exists). |
| `.setState<T>(s: State<T>, value: T): void` | A state's next value: it changes at the next frame's StateTransition. |
| `.schema(crates?: string[] \| undefined): Record<string, unknown>` | The App's registered types as JSON schema (BRP's registry.schema), filtered by crate. |
| `.close(): void` | – |
| `.close(): void` | Shuts the app down; its methods fail after. |
### `PluginGroup`
@@ -172,12 +170,12 @@ leaves one out, and the App adds the rest in order.
| Member | What it does |
| --- | --- |
| `new PluginGroup(name: string, plugins: (string \| Plugin \| { readonly plugin: string; })[])` | – |
| `.name: string` | – |
| `.set(p: Plugin): PluginGroup` | – |
| `.disable(name: string): PluginGroup` | – |
| `.enable(name: string): PluginGroup` | – |
| `.build(): (string \| Plugin)[]` | – |
| `new PluginGroup(name: string, plugins: (string \| Plugin \| { readonly plugin: string; })[])` | A group named `name` of these plugins, in the order the App adds them. |
| `.name: string` | the group's name |
| `.set(p: Plugin): PluginGroup` | Replaces the member of `p`'s name with `p`. |
| `.disable(name: string): PluginGroup` | Leaves the member of this name out. |
| `.enable(name: string): PluginGroup` | Puts a disabled member back. |
| `.build(): (string \| Plugin)[]` | The plugins to add, in order, without the disabled ones. |
## Values
@@ -248,7 +246,7 @@ a split, a cut word or a moved span is a change to this list; the length becomes
| Field | Type | What it is |
| --- | --- | --- |
| `segments` | `readonly (readonly [number, number])[]` | – |
| `segments` | `readonly (readonly [number, number])[]` | the composition's own frame ranges, [from, to), played one after another |
### `OpenOptions`
@@ -266,11 +264,11 @@ does. Unique by `name` unless `isUnique` is false (Bevy panics on a unique plugi
| Field | Type | What it is |
| --- | --- | --- |
| `name` (required) | `string` | – |
| `build` (required) | `(app: BevyApp) => void` | – |
| `finish` | `((app: BevyApp) => void) \| undefined` | – |
| `cleanup` | `((app: BevyApp) => void) \| undefined` | – |
| `isUnique` | `boolean` | – |
| `name` (required) | `string` | the plugin's name: two unique plugins of one name can't both be added |
| `build` (required) | `(app: BevyApp) => void` | adds the plugin's systems, resources and other plugins to the app |
| `finish` | `((app: BevyApp) => void) \| undefined` | called once every plugin is built, for setup that needs the others |
| `cleanup` | `((app: BevyApp) => void) \| undefined` | called after every plugin's finish |
| `isUnique` | `boolean` | whether adding it twice is an error (true) |
### `PluginRef`
@@ -286,13 +284,13 @@ type PluginRef = string | { readonly plugin: string } | Plugin | PluginGroup
| Field | Type | What it is |
| --- | --- | --- |
| `id` (required) | `string` | – |
| `component` (required) | `ComponentType<any>` | – |
| `width` (required) | `number` | – |
| `height` (required) | `number` | – |
| `fps` (required) | `number` | – |
| `durationInFrames` (required) | `number` | – |
| `defaultProps` (required) | `Record<string, unknown>` | – |
| `id` (required) | `string` | the composition's id: letters, digits and dashes (`raea render --composition` picks it) |
| `component` (required) | `ComponentType<any>` | the React component it renders |
| `width` (required) | `number` | in px |
| `height` (required) | `number` | in px |
| `fps` (required) | `number` | frames a second |
| `durationInFrames` (required) | `number` | its length in frames |
| `defaultProps` (required) | `Record<string, unknown>` | the props it's rendered with (JSON-like values only) |
### `SystemOptions`
+14 -14
View File
@@ -121,9 +121,9 @@ type AssetKind = "lyria" | "sao" | "tokensynth"
| Field | Type | What it is |
| --- | --- | --- |
| `kind` (required) | `AssetKind` | – |
| `prompt` (required) | `string` | – |
| `seconds` (required) | `number` | – |
| `kind` (required) | `AssetKind` | which generator makes it: lyria (music), sao (sound effects) or tokensynth (an instrument's note) |
| `prompt` (required) | `string` | what to make, in words |
| `seconds` (required) | `number` | how long it is |
| `id` (required) | `string` | a stable hash of kind, prompt and seconds |
| `src` (required) | `string` | "asset:<kind>/<id>" |
| `options` | `Record<string, unknown>` | the generator's own settings (a TokenSynth note's midi, velocity, seed and device) |
@@ -132,7 +132,7 @@ type AssetKind = "lyria" | "sao" | "tokensynth"
| Field | Type | What it is |
| --- | --- | --- |
| `name` (required) | `string` | – |
| `name` (required) | `string` | the clip's name, as a Model's \`animation\` picks it |
| `times` (required) | `ArrayLike<number>` | sample times (any unit the Model's `time` uses) |
| `rotations` (required) | `ArrayLike<number>[]` | per joint, a quaternion x y z w per sample: the joint's rotation in its parent's frame |
| `translations` | `Record<number, ArrayLike<number>>` | per root joint (by joint index), a translation offset x y z per sample, added to its rest translation |
@@ -141,7 +141,7 @@ type AssetKind = "lyria" | "sao" | "tokensynth"
| Field | Type | What it is |
| --- | --- | --- |
| `name` (required) | `string` | – |
| `name` (required) | `string` | the joint's name (a bone's, as a retarget maps it) |
| `parent` (required) | `number` | index of the parent joint, -1 for a root |
| `head` (required) | `[number, number, number]` | the joint's head in world space at rest (its node's rest translation is head - parent's head) |
@@ -152,31 +152,31 @@ type AssetKind = "lyria" | "sao" | "tokensynth"
| `color` | `string \| Rgba` | hex (#rrggbb) or linear rgba 0..1 |
| `unlit` | `boolean` | drawn without light (KHR_materials_unlit) |
| `blend` | `boolean` | alpha-blended (the colour's alpha, times the vertex colours' alpha) |
| `doubleSided` | `boolean` | – |
| `roughness` | `number` | – |
| `metalness` | `number` | – |
| `emissive` | `string` | – |
| `doubleSided` | `boolean` | draw the back faces too |
| `roughness` | `number` | 0..1, smooth to matte |
| `metalness` | `number` | 0..1, a dielectric to a metal |
| `emissive` | `string` | the colour it glows with |
### `GlbPrimitive`
| Field | Type | What it is |
| --- | --- | --- |
| `positions` (required) | `ArrayLike<number>` | x y z per vertex |
| `normals` | `ArrayLike<number>` | – |
| `normals` | `ArrayLike<number>` | x y z per vertex, unit length |
| `colors` | `ArrayLike<number>` | r g b a per vertex, linear 0..1 (multiplies the material's colour) |
| `indices` | `ArrayLike<number>` | by threes for triangles, by twos for lines; none: every vertex in order |
| `mode` | `"triangles" \| "lines"` | – |
| `mode` | `"triangles" \| "lines"` | what the indices draw: triangles (the default) or lines |
| `joints` | `ArrayLike<number>` | four joint indices per vertex (a skinned mesh) |
| `weights` | `ArrayLike<number>` | four weights per vertex, summing to 1 |
| `material` | `GlbMaterial` | – |
| `material` | `GlbMaterial` | its surface: colour, roughness, metalness, glow |
### `GlbScene`
| Field | Type | What it is |
| --- | --- | --- |
| `primitives` (required) | `GlbPrimitive[]` | – |
| `primitives` (required) | `GlbPrimitive[]` | the meshes it holds |
| `joints` | `GlbJoint[]` | a skin: all primitives are skinned by these joints when it's given |
| `clips` | `GlbClip[]` | – |
| `clips` | `GlbClip[]` | animation clips over the joints |
### `Rgba`
+63 -63
View File
@@ -67,7 +67,7 @@ time: `{hit && <Seedling src={staticFile("hit.wav")} id={`hit-${hits}`} />}`.
| `id` | `string` | the player's identity while it plays: a new id starts a new player (default: the src) |
| `volume` | `number` | linear gain, from the first frame (default 1) |
| `speed` | `number` | playback speed (default 1); may change frame to frame |
| `loop` | `boolean` | – |
| `loop` | `boolean` | start again from the beginning when it ends |
| `fx` | `SeedlingFx[]` | a serial chain of effects on this player |
| `at` | `[number, number, number]` | where it sounds from in the 3D scene (metres, the Canvas3D's frame): heard from the scene's camera, panned, fading and dulling with distance, pitched by its speed toward or away (doppler); may move frame to frame. Unset: a sound with no place |
| `muffle` | `number` | a lowpass (Hz) for what stands between it and the camera: a wall, a window |
@@ -79,10 +79,10 @@ it, hits, the feature lanes, and the pacing (cuts per bar). `raea song FILE --pl
| Prop | Type | What it does |
| --- | --- | --- |
| `map` (required) | `SongMap` | – |
| `width` | `number` | – |
| `height` | `number` | – |
| `title` | `string` | – |
| `map` (required) | `SongMap` | the song's map, from \`raea song\` |
| `width` | `number` | in px |
| `height` | `number` | in px |
| `title` | `string` | the heading (the song's name, tempo, metre and length by default) |
### `Sound3D`
@@ -214,7 +214,7 @@ The props of [`Audio`](#audio), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `text` (required) | `string` | – |
| `text` (required) | `string` | the words to say |
| `voice` | `string` | a Pocket voice ("alba", "marius",...), a clip in ~/.raea-feed/voices by name ("watts"), or a WAV ("/media/narrator.wav" or staticFile("narrator.wav")); the default is "watts" when that clip's there, else alba |
| `seed` | `number` | which take: another seed says it another way (0) |
| `temperature` | `number` | Pocket's sampling temperature: lower is calmer and more even, higher livelier (0.7) |
@@ -240,9 +240,9 @@ The props of [`Seedling`](#seedling), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `map` (required) | `SongMap` | – |
| `fps` (required) | `number` | – |
| `offset` (required) | `number` | – |
| `map` (required) | `SongMap` | the song's map, from \`raea song\` |
| `fps` (required) | `number` | the composition's frame rate, that frames are counted in |
| `offset` (required) | `number` | seconds into the song frame 0 falls on (0) |
| `frame` (required) | `(seconds: number) => number` | the frame a song time falls on |
| `seconds` (required) | `(frame: number) => number` | the song's seconds at a frame |
| `at` (required) | `(frame: number) => SongMoment` | where the song is at a frame |
@@ -255,32 +255,32 @@ The props of [`Seedling`](#seedling), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `time` (required) | `number` | – |
| `beat` (required) | `number` | – |
| `beats` (required) | `number` | – |
| `energy` (required) | `number` | – |
| `cuts` (required) | `number` | – |
| `time` (required) | `number` | seconds from the song's start where the bar begins (its downbeat) |
| `beat` (required) | `number` | the index of its first beat |
| `beats` (required) | `number` | how many beats it holds |
| `energy` (required) | `number` | its mean energy, 0..1 |
| `cuts` (required) | `number` | suggested cuts in this bar: 0.25, 0.5, 1, 2 or 4 |
### `SongEvent`
| Field | Type | What it is |
| --- | --- | --- |
| `kind` (required) | `SongEventKind` | – |
| `kind` (required) | `SongEventKind` | what the event is: build, drop, stop, hit, dip or break |
| `time` (required) | `number` | seconds from the song's start: a beat (drop, a downbeat) or the grid's nearest beat or half beat (hit) |
| `end` | `number` | spans (build, stop, dip, break) end here |
| `beat` (required) | `number` | – |
| `bar` (required) | `number` | – |
| `beats` | `number` | – |
| `beat` (required) | `number` | the index of the beat it starts on, in `SongMap.beats` |
| `bar` (required) | `number` | the index of the bar it starts in |
| `beats` | `number` | a span: how many beats it lasts |
| `strength` (required) | `number` | 0..1 |
| `into` | `number \| null` | a build or stop: the drop it leads into, seconds |
| `hits` | `SongHit[]` | a stop: its sparse hits |
| `rise` | `number` | a drop: the energy of the bar after minus the bar before (negative when the band cuts after one big hit) |
| `holds` | `boolean` | a drop: the bar after stays up (false: one hit, then the band cuts out) |
| `afterStop` | `boolean` | – |
| `afterBuild` | `boolean` | – |
| `afterStop` | `boolean` | a drop: it comes straight out of a stop |
| `afterBuild` | `boolean` | a drop: it lands at the end of a build (within two bars of it) |
| `gapBefore` | `boolean` | a drop: a breath of near-silence just before it |
| `at` | `number` | a hit: the onset's own time; how far over the groove it stands |
| `over` | `number` | – |
| `over` | `number` | a hit: how far over the groove it stands |
### `SongEventKind`
@@ -292,12 +292,12 @@ type SongEventKind = "build" | "drop" | "stop" | "hit" | "dip" | "break"
| Field | Type | What it is |
| --- | --- | --- |
| `loudness` (required) | `number[]` | – |
| `onsets` (required) | `number[]` | – |
| `brightness` (required) | `number[]` | – |
| `low` (required) | `number[]` | – |
| `high` (required) | `number[]` | – |
| `energy` (required) | `number[]` | – |
| `loudness` (required) | `number[]` | loudness (RMS) a beat, 0..1 over the song |
| `onsets` (required) | `number[]` | onset strength (spectral flux) a beat, 0..1: how much is struck |
| `brightness` (required) | `number[]` | brightness (spectral centroid) a beat, 0..1 |
| `low` (required) | `number[]` | the low end (kick and bass, under 150 Hz) a beat, 0..1 |
| `high` (required) | `number[]` | the high band (over 3 kHz) a beat, 0..1 |
| `energy` (required) | `number[]` | the combined energy a beat, 0..1: loudness, low end, onsets and highs together |
### `SongHit`
@@ -305,9 +305,9 @@ A hit inside a stop: `time` on the beat grid (a beat or half beat), `at` where t
| Field | Type | What it is |
| --- | --- | --- |
| `time` (required) | `number` | – |
| `at` (required) | `number` | – |
| `strength` (required) | `number` | – |
| `time` (required) | `number` | seconds from the song's start, snapped to the beat grid (a beat or half beat) |
| `at` (required) | `number` | seconds from the song's start where the onset itself is |
| `strength` (required) | `number` | how hard the hit is, 0..1 |
### `SongLevel`
@@ -319,19 +319,19 @@ type SongLevel = "intro" | "low" | "mid" | "high" | "outro"
| Field | Type | What it is |
| --- | --- | --- |
| `version` (required) | `number` | – |
| `duration` (required) | `number` | – |
| `tempo` (required) | `number \| null` | – |
| `beatsPerBar` (required) | `number` | – |
| `beats` (required) | `number[]` | – |
| `downbeats` (required) | `number[]` | – |
| `version` (required) | `number` | the map format's version (1) |
| `duration` (required) | `number` | the song's length in seconds |
| `tempo` (required) | `number \| null` | beats per minute, or null when no beat was found |
| `beatsPerBar` (required) | `number` | beats in a bar (4 for 4/4) |
| `beats` (required) | `number[]` | every beat's time in seconds, ascending |
| `downbeats` (required) | `number[]` | every bar's first beat, in seconds |
| `features` (required) | `SongFeatures` | one value a beat, 0..1 over the song |
| `bars` (required) | `SongBar[]` | – |
| `sections` (required) | `SongSection[]` | – |
| `events` (required) | `SongEvent[]` | – |
| `sectionsFrom` | `"markers" \| "novelty"` | – |
| `boundaries` | `{ time: number; beat: number; bar: number; strength: number }[]` | – |
| `source` | `string \| null` | – |
| `bars` (required) | `SongBar[]` | the bars in order, each with its energy and suggested cut rate |
| `sections` (required) | `SongSection[]` | the song's sections in order (intro, verse, chorus and so on) |
| `events` (required) | `SongEvent[]` | builds, drops, stops, hits, dips and breaks, in time order |
| `sectionsFrom` | `"markers" \| "novelty"` | where the sections came from: the song file's markers, or novelty in the music itself |
| `boundaries` | `{ time: number; beat: number; bar: number; strength: number }[]` | the candidate section boundaries novelty found, each with its strength 0..1 |
| `source` | `string \| null` | the song file's name |
### `SongMoment`
@@ -339,30 +339,30 @@ Where a moment of the song is. Seconds are the song's; infinities when there's n
| Field | Type | What it is |
| --- | --- | --- |
| `time` (required) | `number` | – |
| `time` (required) | `number` | the moment, seconds from the song's start |
| `beat` (required) | `number` | the beat at or before `time` (-1 before the first) |
| `bar` (required) | `number` | the bar at or before `time` (-1 before the first beat) |
| `beatInBar` (required) | `number` | 0-based position in the bar |
| `phase` (required) | `number` | 0..1 through the beat, and through the bar |
| `barPhase` (required) | `number` | – |
| `barPhase` (required) | `number` | 0..1 through the bar |
| `energy` (required) | `number` | the features at `time`, interpolated between beats |
| `loudness` (required) | `number` | – |
| `onsets` (required) | `number` | – |
| `brightness` (required) | `number` | – |
| `low` (required) | `number` | – |
| `section` (required) | `SongSection \| null` | – |
| `sectionIndex` (required) | `number` | – |
| `loudness` (required) | `number` | loudness at `time`, 0..1 |
| `onsets` (required) | `number` | onset strength at `time`, 0..1 |
| `brightness` (required) | `number` | brightness at `time`, 0..1 |
| `low` (required) | `number` | the low end at `time`, 0..1 |
| `section` (required) | `SongSection \| null` | the section `time` is in (null before the first) |
| `sectionIndex` (required) | `number` | that section's index in `SongMap.sections` (-1 for none) |
| `sectionProgress` (required) | `number` | 0..1 through the section |
| `cutsPerBar` (required) | `number` | the bar's suggested cut rate (cuts per bar) |
| `drop` (required) | `SongEvent \| null` | the last drop at or before `time`, the next after it |
| `nextDrop` (required) | `SongEvent \| null` | – |
| `sinceDrop` (required) | `number` | – |
| `untilDrop` (required) | `number` | – |
| `nextDrop` (required) | `SongEvent \| null` | the next drop after `time` |
| `sinceDrop` (required) | `number` | seconds since the last drop (Infinity when there's none) |
| `untilDrop` (required) | `number` | seconds until the next drop (Infinity when there's none) |
| `build` (required) | `SongEvent \| null` | the build `time` is in, and 0..1 through it |
| `inBuild` (required) | `boolean` | – |
| `buildProgress` (required) | `number` | – |
| `inBuild` (required) | `boolean` | whether `time` is inside a build |
| `buildProgress` (required) | `number` | 0..1 through that build |
| `stop` (required) | `SongEvent \| null` | the stop `time` is in |
| `inStop` (required) | `boolean` | – |
| `inStop` (required) | `boolean` | whether `time` is inside a stop |
| `dip` (required) | `SongEvent \| null` | the dip or break `time` is in |
| `next` (required) | `SongEvent \| null` | the next event of any kind after `time` |
@@ -381,13 +381,13 @@ The props of [`SongPlot`](#songplot), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `name` (required) | `string` | – |
| `level` (required) | `SongLevel` | – |
| `time` (required) | `number` | – |
| `end` (required) | `number` | – |
| `beat` (required) | `number` | – |
| `bar` (required) | `number` | – |
| `energy` (required) | `number` | – |
| `name` (required) | `string` | the section's marker name when the song file has markers, else its level |
| `level` (required) | `SongLevel` | how high the section sits in the song: intro, low, mid, high or outro |
| `time` (required) | `number` | seconds from the song's start where the section begins |
| `end` (required) | `number` | seconds from the song's start where it ends |
| `beat` (required) | `number` | the index of its first beat |
| `bar` (required) | `number` | the index of its first bar |
| `energy` (required) | `number` | its mean energy, 0..1 |
| `cuts` (required) | `number` | suggested cuts per bar: 0.25, 0.5, 1, 2 or 4 |
### `SpeechProps`
-2
View File
@@ -48,8 +48,6 @@ function brief(b: Brief): Brief
### `controller`
A workspace's controller (controllers/<id>.ts): settings in groups of typed fields that every agent works to.
A standing decision ("every ad is 9:16"), not one piece of work: that's a feed item, and a note on it. The raea app
shows a new controller in the project's feed, and an agent brings one to the person with `controller_post`.
```ts
function controller(c: ControllerInput): ControllerInput
+28 -32
View File
@@ -34,15 +34,15 @@ Bevy: `bevy_camera::components::Camera3d`, `bevy_camera::camera::Camera`, `bevy_
| Prop | Type | What it does |
| --- | --- | --- |
| `transform` | `TransformValue` | – |
| `projection` | `Projection` | – |
| `transform` | `TransformValue` | where the camera stands and faces (`Transform.fromXYZ(...).lookingAt(...)`) |
| `projection` | `Projection` | perspective (the default) or orthographic, as Bevy's Projection |
| `layers` | `number[]` | Bevy's RenderLayers on the camera: it draws only the parts on these layers (a Mesh3d's `layers`; [0] by default) |
| `order` | `number` | Bevy's Camera order: a camera with a higher one draws after (over) those with lower; 0 by default |
| `clear_color` | `ClearColorConfig` | Bevy's ClearColorConfig: "Default" (the clear colour), "None" (drawn over what the cameras before it drew, as a second pass), or { Custom: colour } |
| `viewport` | `CameraViewport` | Bevy's Viewport: the camera draws into this region of the window only, `physical_position` from its top left and `physical_size` big (whole px, at a scale factor of 1) |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | components on the camera: post effects, tone mapping, a skybox |
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/widgets/viewport_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/viewport_node.tsx), [3d/fog_volumes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog_volumes.tsx), [3d/fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog.tsx), [3d/vertex_colors](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/vertex_colors.tsx), [3d/rotate_environment_map](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/rotate_environment_map.tsx), [3d/transparency_3d](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx), [3d/spherical_area_lights](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spherical_area_lights.tsx), and 61 more.
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/widgets/viewport_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/viewport_node.tsx), [3d/fog_volumes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog_volumes.tsx), [3d/fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog.tsx), [3d/vertex_colors](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/vertex_colors.tsx), [3d/rotate_environment_map](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/rotate_environment_map.tsx), [3d/transparency_3d](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx), [3d/spherical_area_lights](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spherical_area_lights.tsx), and 60 more.
### `Canvas3D`
@@ -74,17 +74,13 @@ Takes [`MatchmoveProps`](3d.md#matchmoveprops)'s props.
### `TextureView`
A Bevy texture in an element: `texture` is the id a system lists an Image under in the App's PageTextures (a
camera's target, a video's frame), drawn at the element's box GPU to GPU. The other props are the <img>'s, its style
placing and sizing it.
<TextureView texture={7} style={{ position: "absolute", left: 100, top: 50, width: 200, height: 150 }} />
the GPU texture's number
Bevy: `bevy_render::TextureView`.
| Prop | Type | What it does |
| --- | --- | --- |
| `texture` (required) | `number` | – |
| `texture` (required) | `number` | the id a system lists the Image under in the App's PageTextures |
Also takes the props of `ImgHTMLAttributes` (`height`, `alt`, `crossOrigin`, `decoding`, `fetchPriority`, `loading`, `referrerPolicy`, `sizes`, `srcSet`, `useMap`, `width`); `HTMLAttributes` (`slot`, `style`, `title`, `hidden`, `color`, `content`, `part`, `className`, `id`, `defaultChecked`, `defaultValue`, `suppressContentEditableWarning`, `suppressHydrationWarning`, `accessKey`, `autoCapitalize`, `autoFocus`, `contentEditable`, `contextMenu`, `dir`, `draggable`, `enterKeyHint`, `lang`, `nonce`, `spellCheck`, `tabIndex`, `translate`, `radioGroup`, `role`, `about`, `datatype`, `inlist`, `prefix`, `property`, `rel`, `resource`, `rev`, `typeof`, `vocab`, `autoCorrect`, `autoSave`, `itemProp`, `itemScope`, `itemType`, `itemID`, `itemRef`, `results`, `security`, `unselectable`, `popover`, `popoverTargetAction`, `popoverTarget`, `inert`, `inputMode`, `is`, `exportparts`); `DOMAttributes` (`children`, `dangerouslySetInnerHTML`, `onCopy`, `onCopyCapture`, `onCut`, `onCutCapture`, `onPaste`, `onPasteCapture`, `onCompositionEnd`, `onCompositionEndCapture`, `onCompositionStart`, `onCompositionStartCapture`, `onCompositionUpdate`, `onCompositionUpdateCapture`, `onFocus`, `onFocusCapture`, `onBlur`, `onBlurCapture`, `onChange`, `onChangeCapture`, `onBeforeInput`, `onBeforeInputCapture`, `onInput`, `onInputCapture`, `onReset`, `onResetCapture`, `onSubmit`, `onSubmitCapture`, `onInvalid`, `onInvalidCapture`, `onLoad`, `onLoadCapture`, `onError`, `onErrorCapture`, `onKeyDown`, `onKeyDownCapture`, `onKeyPress`, `onKeyPressCapture`, `onKeyUp`, `onKeyUpCapture`, `onAbort`, `onAbortCapture`, `onCanPlay`, `onCanPlayCapture`, `onCanPlayThrough`, `onCanPlayThroughCapture`, `onDurationChange`, `onDurationChangeCapture`, `onEmptied`, `onEmptiedCapture`, `onEncrypted`, `onEncryptedCapture`, `onEnded`, `onEndedCapture`, `onLoadedData`, `onLoadedDataCapture`, `onLoadedMetadata`, `onLoadedMetadataCapture`, `onLoadStart`, `onLoadStartCapture`, `onPause`, `onPauseCapture`, `onPlay`, `onPlayCapture`, `onPlaying`, `onPlayingCapture`, `onProgress`, `onProgressCapture`, `onRateChange`, `onRateChangeCapture`, `onSeeked`, `onSeekedCapture`, `onSeeking`, `onSeekingCapture`, `onStalled`, `onStalledCapture`, `onSuspend`, `onSuspendCapture`, `onTimeUpdate`, `onTimeUpdateCapture`, `onVolumeChange`, `onVolumeChangeCapture`, `onWaiting`, `onWaitingCapture`, `onAuxClick`, `onAuxClickCapture`, `onClick`, `onClickCapture`, `onContextMenu`, `onContextMenuCapture`, `onDoubleClick`, `onDoubleClickCapture`, `onDrag`, `onDragCapture`, `onDragEnd`, `onDragEndCapture`, `onDragEnter`, `onDragEnterCapture`, `onDragExit`, `onDragExitCapture`, `onDragLeave`, `onDragLeaveCapture`, `onDragOver`, `onDragOverCapture`, `onDragStart`, `onDragStartCapture`, `onDrop`, `onDropCapture`, `onMouseDown`, `onMouseDownCapture`, `onMouseEnter`, `onMouseLeave`, `onMouseMove`, `onMouseMoveCapture`, `onMouseOut`, `onMouseOutCapture`, `onMouseOver`, `onMouseOverCapture`, `onMouseUp`, `onMouseUpCapture`, `onSelect`, `onSelectCapture`, `onTouchCancel`, `onTouchCancelCapture`, `onTouchEnd`, `onTouchEndCapture`, `onTouchMove`, `onTouchMoveCapture`, `onTouchStart`, `onTouchStartCapture`, `onPointerDown`, `onPointerDownCapture`, `onPointerMove`, `onPointerMoveCapture`, `onPointerUp`, `onPointerUpCapture`, `onPointerCancel`, `onPointerCancelCapture`, `onPointerEnter`, `onPointerLeave`, `onPointerOver`, `onPointerOverCapture`, `onPointerOut`, `onPointerOutCapture`, `onGotPointerCapture`, `onGotPointerCaptureCapture`, `onLostPointerCapture`, `onLostPointerCaptureCapture`, `onScroll`, `onScrollCapture`, `onScrollEnd`, `onScrollEndCapture`, `onWheel`, `onWheelCapture`, `onAnimationStart`, `onAnimationStartCapture`, `onAnimationEnd`, `onAnimationEndCapture`, `onAnimationIteration`, `onAnimationIterationCapture`, `onToggle`, `onBeforeToggle`, `onTransitionCancel`, `onTransitionCancelCapture`, `onTransitionEnd`, `onTransitionEndCapture`, `onTransitionRun`, `onTransitionRunCapture`, `onTransitionStart`, `onTransitionStartCapture`); `AriaAttributes` (`aria-activedescendant`, `aria-atomic`, `aria-autocomplete`, `aria-braillelabel`, `aria-brailleroledescription`, `aria-busy`, `aria-checked`, `aria-colcount`, `aria-colindex`, `aria-colindextext`, `aria-colspan`, `aria-controls`, `aria-current`, `aria-describedby`, `aria-description`, `aria-details`, `aria-disabled`, `aria-dropeffect`, `aria-errormessage`, `aria-expanded`, `aria-flowto`, `aria-grabbed`, `aria-haspopup`, `aria-hidden`, `aria-invalid`, `aria-keyshortcuts`, `aria-label`, `aria-labelledby`, `aria-level`, `aria-live`, `aria-modal`, `aria-multiline`, `aria-multiselectable`, `aria-orientation`, `aria-owns`, `aria-placeholder`, `aria-posinset`, `aria-pressed`, `aria-readonly`, `aria-relevant`, `aria-required`, `aria-roledescription`, `aria-rowcount`, `aria-rowindex`, `aria-rowindextext`, `aria-rowspan`, `aria-selected`, `aria-setsize`, `aria-sort`, `aria-valuemax`, `aria-valuemin`, `aria-valuenow`, `aria-valuetext`).
@@ -137,8 +133,8 @@ Bevy's Viewport on a Camera, its depth range Bevy's default 0..1.
| Field | Type | What it is |
| --- | --- | --- |
| `physical_position` (required) | `[number, number]` | – |
| `physical_size` (required) | `[number, number]` | – |
| `physical_position` (required) | `[number, number]` | the viewport's top-left corner, in px |
| `physical_size` (required) | `[number, number]` | the viewport's width and height, in px |
### `Canvas3DProps`
@@ -146,7 +142,7 @@ Bevy's Viewport on a Camera, its depth range Bevy's default 0..1.
| --- | --- | --- |
| `layered` | `boolean` | the 3D takes its place in the page's tree order instead of lying under the whole page: page elements before the Canvas3D (and the backgrounds of the elements holding it) are under the 3D, showing wherever it has nothing, and hidden by its parts; positioned elements after it are over it. The 3D's background is transparent. Put the Canvas3D straight in a full-frame AbsoluteFill. |
| `clearColor` | `string` | only with `layered`: the 3D clears to this CSS colour instead of transparent, so its translucent parts blend over it in linear light, as Bevy's do over its ClearColor (a Bevy 2D scene's rgb(43, 44, 47)), not over the page in sRGB. The 3D then lies under the whole page, as Bevy's camera output lies under all its UI (a GlobalZIndex(-1) too). |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | the 3D scene: cameras, lights and parts |
### `ClearColorConfig`
@@ -162,8 +158,8 @@ type ClearColorConfig = "Default" | "None" | { Custom: Srgba | LinearRgba }
| Field | Type | What it is |
| --- | --- | --- |
| `t` (required) | `number` | – |
| `position` (required) | `Vec3` | – |
| `t` (required) | `number` | seconds into the clip |
| `position` (required) | `Vec3` | where the camera is, in the solved world (metres) |
| `quaternion` (required) | `[number, number, number, number]` | camera to world, [x, y, z, w]; the camera looks down its -Z with +Y up |
| `solved` (required) | `boolean` | false: COLMAP didn't register this frame and its pose was interpolated |
@@ -173,7 +169,7 @@ type ClearColorConfig = "Default" | "None" | { Custom: Srgba | LinearRgba }
| --- | --- | --- |
| `src` (required) | `string` | the footage: staticFile("clip.mp4") |
| `from` | `number` | where in the clip the shot starts, and how long it runs (seconds; 0 = to the end) |
| `seconds` | `number` | – |
| `seconds` | `number` | how long the shot runs, seconds (0: to the clip's end) |
| `subject` | `[number, number, number, number]` | the subject to keep in front of the 3D and out of the solve: a box around it on the first frame, [x, y, w, h] in 0..1 of the frame (EdgeTAM tracks it from there) |
| `height` | `number` | the camera's height over the ground in metres (1.6 by default: handheld) |
| `fov` | `number` | the vertical field of view in degrees, for a shot without parallax (a tripod, a pan); a solve with structure finds its own |
@@ -191,24 +187,24 @@ What `raea track` writes and <Matchmove> draws from.
| Field | Type | What it is |
| --- | --- | --- |
| `mode` (required) | `"sfm" \| "rotation" \| "static"` | – |
| `mode` (required) | `"sfm" \| "rotation" \| "static"` | "sfm": a full solve with structure; "rotation": the camera only turns (too little parallax, or too few frames registered); "static": it doesn't move |
| `width` (required) | `number` | the footage's size in pixels, and its frame rate |
| `height` (required) | `number` | – |
| `fps` (required) | `number` | – |
| `from` (required) | `number` | – |
| `seconds` (required) | `number` | – |
| `frames` (required) | `number` | – |
| `height` (required) | `number` | the footage's height in pixels |
| `fps` (required) | `number` | the footage's frame rate |
| `from` (required) | `number` | where in the clip the solve starts, seconds |
| `seconds` (required) | `number` | how long it runs, seconds |
| `frames` (required) | `number` | how many frames it solved |
| `fov` (required) | `number` | vertical field of view, degrees; focal length in pixels; the lens's radial distortion |
| `focal` (required) | `number` | – |
| `k1` (required) | `number` | – |
| `registered` (required) | `number` | – |
| `focal` (required) | `number` | the focal length in pixels, at the footage's full size |
| `k1` (required) | `number` | the lens's radial distortion |
| `registered` (required) | `number` | how many frames COLMAP registered; the rest were interpolated |
| `error` (required) | `number \| null` | mean reprojection error in pixels (null without structure) |
| `camera_height` (required) | `number` | – |
| `cameras` (required) | `MatchmoveCamera[]` | – |
| `camera_height` (required) | `number` | the camera's height over the ground, metres, that set the world's scale |
| `cameras` (required) | `MatchmoveCamera[]` | the camera a frame |
| `points` (required) | `Vec3[]` | the sparse points, in the solved world |
| `ground` (required) | `{ y: number; normal: Vec3 }` | – |
| `ground` (required) | `{ y: number; normal: Vec3 }` | the ground plane: its height (0) and normal (+Y) |
| `cut` (required) | `string \| null` | the subject's cut-outs, a path with %04d for the frame (1-based), or null |
| `notes` (required) | `string[]` | – |
| `notes` (required) | `string[]` | what the solver noticed: fallbacks, an assumed field of view, interpolated frames |
### `MatchmoveState`
@@ -216,10 +212,10 @@ Each frame's state under a <Matchmove>, for the 3D inside it.
| Field | Type | What it is |
| --- | --- | --- |
| `solve` (required) | `MatchmoveSolve` | – |
| `solve` (required) | `MatchmoveSolve` | the solve it draws from |
| `index` (required) | `number` | the solve's frame shown now (0-based), and the clip's time |
| `time` (required) | `number` | – |
| `camera` (required) | `MatchmoveCamera` | – |
| `time` (required) | `number` | the clip's time at this frame, seconds |
| `camera` (required) | `MatchmoveCamera` | the solve's camera for this frame |
| `project` (required) | `(p: Vec3) => [number, number, number]` | where a point of the solved world lands in the composition, in pixels ([x, y], and its distance in front of the camera; behind it when that's 0 or less) |
### `Projection`
+62 -62
View File
@@ -49,19 +49,19 @@ function toHex(owner: string, k: string, v: unknown): string
Bevy's Hsla: hue (degrees), saturation and lightness, each 0..1; converted through Hsva and Hwba, as Bevy's is.
Bevy: `bevy_color::Hsla`.
Bevy: `bevy_color::hsla::Hsla`.
| Member | What it does |
| --- | --- |
| `new Hsla(hue: number, saturation: number, lightness: number, alpha?: number)` | – |
| `Hsla.from(c: Rgb): Hsla` | – |
| `.hue: number` | – |
| `.saturation: number` | – |
| `.lightness: number` | – |
| `.alpha: number` | – |
| `.to_srgba(): Srgba` | – |
| `.to_linear(): LinearRgba` | – |
| `.mix(o: Hsla, t: number): Hsla` | – |
| `new Hsla(hue: number, saturation: number, lightness: number, alpha?: number)` | Hue in degrees (0 to 360), saturation, lightness and alpha 0 to 1. |
| `Hsla.from(c: Rgb): Hsla` | The same colour from an Srgba or LinearRgba. |
| `.hue: number` | Bevy: The hue channel. [0.0, 360.0] |
| `.saturation: number` | Bevy: The saturation channel. [0.0, 1.0] |
| `.lightness: number` | Bevy: The lightness channel. [0.0, 1.0] |
| `.alpha: number` | Bevy: The alpha channel. [0.0, 1.0] |
| `.to_srgba(): Srgba` | The same colour as an Srgba. |
| `.to_linear(): LinearRgba` | The same colour as a LinearRgba. |
| `.mix(o: Hsla, t: number): Hsla` | The colour `t` (0 to 1) of the way to `o`, mixed in this space. |
Used in: [ui/scroll_and_overflow/drag_to_scroll](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/drag_to_scroll.tsx), [ui/ui_material](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/ui_material.tsx), [ui/widgets/feathers_gallery](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/feathers_gallery.tsx), [animation/color_animation](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/animation/color_animation.tsx), [2d/2d_shapes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/2d/2d_shapes.tsx), [shader_advanced/custom_shader_instancing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/shader_advanced/custom_shader_instancing.tsx).
@@ -69,17 +69,17 @@ Used in: [ui/scroll_and_overflow/drag_to_scroll](https://github.com/shinyobjectz
Bevy's LinearRgba: linear light, which a StandardMaterial's emissive is; a channel past 1 is brighter than white.
Bevy: `bevy_color::LinearRgba`.
Bevy: `bevy_color::linear_rgba::LinearRgba`.
| Member | What it does |
| --- | --- |
| `new LinearRgba(red: number, green: number, blue: number, alpha?: number)` | – |
| `LinearRgba.rgb(red: number, green: number, blue: number): LinearRgba` | – |
| `new LinearRgba(red: number, green: number, blue: number, alpha?: number)` | Linear red, green, blue (above 1 for brighter than white) and alpha. |
| `LinearRgba.rgb(red: number, green: number, blue: number): LinearRgba` | An opaque linear colour. |
| `LinearRgba.from(c: Srgba): LinearRgba` | Bevy's LinearRgba::from(Srgba) |
| `.red: number` | – |
| `.green: number` | – |
| `.blue: number` | – |
| `.alpha: number` | – |
| `.red: number` | Bevy: The red channel. [0.0, 1.0] for SDR colors. |
| `.green: number` | Bevy: The green channel. [0.0, 1.0] for SDR colors. |
| `.blue: number` | Bevy: The blue channel. [0.0, 1.0] for SDR colors. |
| `.alpha: number` | Bevy: The alpha channel. [0.0, 1.0] |
| `.to_srgba(): Srgba` | Bevy's Srgba::from(LinearRgba): gamma-encoded (a channel at or below 0 kept as it is) |
| `.luminance(): number` | Bevy's Luminance::luminance: Rec. 709's weights over the linear channels |
| `.darker(amount: number): LinearRgba` | Bevy's Luminance::darker: mixed toward black until its luminance is `amount` lower (at least 0) |
@@ -98,17 +98,17 @@ Bevy: `bevy_color::Okhsla`.
| Member | What it does |
| --- | --- |
| `new Okhsla(hue: number, saturation: number, lightness: number, alpha?: number)` | – |
| `new Okhsla(hue: number, saturation: number, lightness: number, alpha?: number)` | Hue in degrees, saturation, lightness and alpha 0 to 1, in Okhsl. |
| `Okhsla.from_oklaba(lab: Oklaba): Okhsla` | From Oklab (bevy_color oklab_to_okhsl). |
| `Okhsla.from(c: Srgba \| LinearRgba \| Hsla): Okhsla` | From any sRGB colour, through Oklab. |
| `.hue: number` | – |
| `.saturation: number` | – |
| `.lightness: number` | – |
| `.alpha: number` | – |
| `.hue: number` | Bevy: The hue channel. [0.0, 360.0] |
| `.saturation: number` | Bevy: The saturation channel. [0.0, 1.0] |
| `.lightness: number` | Bevy: The lightness channel. [0.0, 1.0] |
| `.alpha: number` | Bevy: The alpha channel. [0.0, 1.0] |
| `.to_oklaba(): Oklaba` | To Oklab (bevy_color okhsl_to_oklab). |
| `.to_linear(): LinearRgba` | – |
| `.to_srgba(): Srgba` | – |
| `.with_alpha(alpha: number): Okhsla` | – |
| `.to_linear(): LinearRgba` | The same colour as a LinearRgba. |
| `.to_srgba(): Srgba` | The same colour as an Srgba. |
| `.with_alpha(alpha: number): Okhsla` | The same colour with this alpha. |
Used in: [ui/widgets/feathers_gallery](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/feathers_gallery.tsx).
@@ -116,19 +116,19 @@ Used in: [ui/widgets/feathers_gallery](https://github.com/shinyobjectz/raea/blob
Bevy's Oklaba: perceptual lightness and two opponent axes.
Bevy: `bevy_color::Oklaba`.
Bevy: `bevy_color::oklaba::Oklaba`.
| Member | What it does |
| --- | --- |
| `new Oklaba(lightness: number, a: number, b: number, alpha?: number)` | – |
| `Oklaba.from(c: Oklcha \| Rgb): Oklaba` | – |
| `.lightness: number` | – |
| `.a: number` | – |
| `.b: number` | – |
| `.alpha: number` | – |
| `.to_linear(): LinearRgba` | – |
| `.to_srgba(): Srgba` | – |
| `.mix(o: Oklaba, t: number): Oklaba` | – |
| `new Oklaba(lightness: number, a: number, b: number, alpha?: number)` | Perceptual lightness, a (green to red), b (blue to yellow) and alpha. |
| `Oklaba.from(c: Oklcha \| Rgb): Oklaba` | The same colour from an Srgba, LinearRgba or Oklcha. |
| `.lightness: number` | Bevy: The 'lightness' channel. [0.0, 1.0] |
| `.a: number` | Bevy: The 'a' channel. [-1.0, 1.0] |
| `.b: number` | Bevy: The 'b' channel. [-1.0, 1.0] |
| `.alpha: number` | Bevy: The alpha channel. [0.0, 1.0] |
| `.to_linear(): LinearRgba` | The same colour as a LinearRgba. |
| `.to_srgba(): Srgba` | The same colour as an Srgba. |
| `.mix(o: Oklaba, t: number): Oklaba` | The colour `t` (0 to 1) of the way to `o`, mixed in this space. |
Used in: [animation/color_animation](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/animation/color_animation.tsx).
@@ -136,19 +136,19 @@ Used in: [animation/color_animation](https://github.com/shinyobjectz/raea/blob/m
Bevy's Oklcha: Oklab's lightness, chroma and hue (degrees).
Bevy: `bevy_color::Oklcha`.
Bevy: `bevy_color::oklcha::Oklcha`.
| Member | What it does |
| --- | --- |
| `new Oklcha(lightness: number, chroma: number, hue: number, alpha?: number)` | – |
| `Oklcha.from(c: Rgb \| Oklaba): Oklcha` | – |
| `.lightness: number` | – |
| `.chroma: number` | – |
| `.hue: number` | – |
| `.alpha: number` | – |
| `.to_linear(): LinearRgba` | – |
| `.to_srgba(): Srgba` | – |
| `.mix(o: Oklcha, t: number): Oklcha` | – |
| `new Oklcha(lightness: number, chroma: number, hue: number, alpha?: number)` | Perceptual lightness, chroma, hue in degrees and alpha. |
| `Oklcha.from(c: Rgb \| Oklaba): Oklcha` | The same colour from an Srgba, LinearRgba or Oklaba. |
| `.lightness: number` | Bevy: The 'lightness' channel. [0.0, 1.0] |
| `.chroma: number` | Bevy: The 'chroma' channel. [0.0, 1.0] |
| `.hue: number` | Bevy: The 'hue' channel. [0.0, 360.0] |
| `.alpha: number` | Bevy: The alpha channel. [0.0, 1.0] |
| `.to_linear(): LinearRgba` | The same colour as a LinearRgba. |
| `.to_srgba(): Srgba` | The same colour as an Srgba. |
| `.mix(o: Oklcha, t: number): Oklcha` | The colour `t` (0 to 1) of the way to `o`, mixed in this space. |
| `.lighter(amount: number): Oklcha` | Bevy's Luminance::lighter: the lightness raised by `amount`, at most 1 |
| `.darker(amount: number): Oklcha` | Bevy's Luminance::darker: the lightness lowered by `amount`, at least 0 |
| `.with_alpha(alpha: number): Oklcha` | Bevy's Alpha::with_alpha |
@@ -159,19 +159,19 @@ Used in: [animation/color_animation](https://github.com/shinyobjectz/raea/blob/m
Bevy's Srgba: gamma-encoded colour, each channel 0..1.
Bevy: `bevy_color::Srgba`.
Bevy: `bevy_color::srgba::Srgba`.
| Member | What it does |
| --- | --- |
| `new Srgba(red: number, green: number, blue: number, alpha?: number)` | – |
| `new Srgba(red: number, green: number, blue: number, alpha?: number)` | sRGB red, green, blue and alpha, each 0 to 1. |
| `Srgba.hex(hex: string): Srgba` | Bevy's Srgba::hex: rgb, rgba, rrggbb or rrggbbaa (the # optional), and also rgb() or a common name |
| `.red: number` | – |
| `.green: number` | – |
| `.blue: number` | – |
| `.alpha: number` | – |
| `.red: number` | Bevy: The red channel. [0.0, 1.0] for SDR colors. |
| `.green: number` | Bevy: The green channel. [0.0, 1.0] for SDR colors. |
| `.blue: number` | Bevy: The blue channel. [0.0, 1.0] for SDR colors. |
| `.alpha: number` | Bevy: The alpha channel. [0.0, 1.0] |
| `.darker(amount: number): Srgba` | Bevy's Luminance::darker on an Srgba: its linear colour's, encoded again |
| `.lighter(amount: number): Srgba` | Bevy's Luminance::lighter on an Srgba: its linear colour's, encoded again |
| `.with_alpha(alpha: number): Srgba` | – |
| `.with_alpha(alpha: number): Srgba` | The same colour with this alpha. |
| `.to_hex(): string` | Bevy's Srgba::to_hex: #RRGGBB (and AA when not opaque), each channel clamped and rounded |
| `.mix(o: Srgba, t: number): Srgba` | Bevy's Mix: each channel lerped, in f32 |
@@ -181,19 +181,19 @@ Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/s
Bevy's Xyza: CIE 1931 XYZ (D65, as linear sRGB's).
Bevy: `bevy_color::Xyza`.
Bevy: `bevy_color::xyza::Xyza`.
| Member | What it does |
| --- | --- |
| `new Xyza(x: number, y: number, z: number, alpha?: number)` | – |
| `Xyza.from(c: Rgb): Xyza` | – |
| `.x: number` | – |
| `.y: number` | – |
| `.z: number` | – |
| `.alpha: number` | – |
| `.to_linear(): LinearRgba` | – |
| `.to_srgba(): Srgba` | – |
| `.mix(o: Xyza, t: number): Xyza` | – |
| `new Xyza(x: number, y: number, z: number, alpha?: number)` | CIE XYZ and alpha. |
| `Xyza.from(c: Rgb): Xyza` | The same colour from an Srgba or LinearRgba. |
| `.x: number` | Bevy: The x-axis. [0.0, 0.9505] for SDR colors. |
| `.y: number` | Bevy: The y-axis, intended to represent luminance. [0.0, 1.0] for SDR colors. |
| `.z: number` | Bevy: The z-axis. [0.0, 1.0889] for SDR colors. |
| `.alpha: number` | Bevy: The alpha channel. [0.0, 1.0] |
| `.to_linear(): LinearRgba` | The same colour as a LinearRgba. |
| `.to_srgba(): Srgba` | The same colour as an Srgba. |
| `.mix(o: Xyza, t: number): Xyza` | The colour `t` (0 to 1) of the way to `o`, mixed in this space. |
Used in: [animation/color_animation](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/animation/color_animation.tsx).
+7 -7
View File
@@ -42,12 +42,12 @@ function motionLint(lib: MotionLibrary, perf: Performance, o?: { margin?: number
| Field | Type | What it is |
| --- | --- | --- |
| `frame` (required) | `number` | first and peak frames |
| `peak` (required) | `number` | – |
| `frames` (required) | `number` | – |
| `joint` (required) | `string` | – |
| `kind` (required) | `"speed" \| "jerk" \| "buckle"` | – |
| `peak` (required) | `number` | the frame it's worst on |
| `frames` (required) | `number` | how many frames it lasts |
| `joint` (required) | `string` | the joint it's on |
| `kind` (required) | `"speed" \| "jerk" \| "buckle"` | what's wrong: too fast (speed), a jolt (jerk) or a joint bent past its limit (buckle) |
| `value` (required) | `number` | the peak's value (degrees a frame, a frame², or degrees past the clip's knee) and what the library allows |
| `limit` (required) | `number` | – |
| `limit` (required) | `number` | what the library allows |
| `stage` (required) | `Stage` | the first stage that shows it |
| `causes` (required) | `string[]` | what happened within three frames of it |
@@ -55,8 +55,8 @@ function motionLint(lib: MotionLibrary, perf: Performance, o?: { margin?: number
| Field | Type | What it is |
| --- | --- | --- |
| `findings` (required) | `Finding[]` | – |
| `frames` (required) | `number` | – |
| `findings` (required) | `Finding[]` | what's wrong, each with its frames, joint and cause |
| `frames` (required) | `number` | how many frames were checked |
### `Stage`
+22 -22
View File
@@ -81,7 +81,7 @@ Bevy: `bevy_feathers::controls::FeathersColorSlider`.
| Prop | Type | What it does |
| --- | --- | --- |
| `value` | `number` | SliderValue: the channel's value, in its range |
| `channel` | `ColorChannel` | – |
| `channel` | `ColorChannel` | which colour channel it sets: Red, Green, Blue, Alpha, or HSL or Okhsl hue, saturation or lightness |
| `base_color` | `FeathersColor` | SliderBaseColor: the colour the track shows the channel of (white by default) |
Also takes the props of [`NodeProps`](ui.md#nodeprops); `PickProps` (`popover`, `onClick`, `onPointerDown`, `onPointerUp`, `onPointerOver`, `onPointerOut`, `onPointerEnter`, `onPointerLeave`, `onPointerMove`).
@@ -99,7 +99,7 @@ Bevy: `bevy_feathers::controls::FeathersColorSwatch`.
| --- | --- | --- |
| `color` | `FeathersColor` | ColorSwatchValue: the colour shown over the checkerboard |
| `opaque_color_percentage` | `number` | how much of its right side shows the colour opaque, in percent |
| `corners` | `RoundedCorners` | – |
| `corners` | `RoundedCorners` | which corners are rounded |
| `border_radius` | `number` | the corners' radius in px (5 by default), on the corners `corners` names |
Also takes the props of [`NodeProps`](ui.md#nodeprops); `PickProps` (`popover`, `onClick`, `onPointerDown`, `onPointerMove`, `onPointerUp`, `onPointerEnter`, `onPointerLeave`, `onPointerOver`, `onPointerOut`).
@@ -263,7 +263,7 @@ Bevy: `bevy_feathers::controls::FeathersScrollbar`.
| Prop | Type | What it does |
| --- | --- | --- |
| `target` (required) | `string` | the Name of the Node it scrolls |
| `orientation` | `ControlOrientation` | – |
| `orientation` | `ControlOrientation` | which way it scrolls: Vertical or Horizontal |
| `hidden` | `boolean` | hidden: the auto_hide decision, made by the list view (Bevy makes it after layout) |
Also takes the props of [`NodeProps`](ui.md#nodeprops); `PickProps` (`popover`, `onClick`, `onPointerDown`, `onPointerUp`, `onPointerOver`, `onPointerOut`, `onPointerEnter`, `onPointerLeave`, `onPointerMove`).
@@ -277,7 +277,7 @@ Bevy: `bevy_feathers::controls::FeathersSelect`.
| Prop | Type | What it does |
| --- | --- | --- |
| `options` (required) | `ReactNode` | its options: FeathersListRows, one of them selected (list_rows_from_strings) |
| `corners` | `RoundedCorners` | – |
| `corners` | `RoundedCorners` | which corners are rounded |
| `max_visible` | `number` | the popup's most rows (8 by default) |
Also takes the props of [`NodeProps`](ui.md#nodeprops); `PickProps` (`popover`, `onClick`, `onPointerDown`, `onPointerUp`, `onPointerOver`, `onPointerOut`, `onPointerEnter`, `onPointerLeave`, `onPointerMove`).
@@ -294,7 +294,7 @@ Bevy: `bevy_feathers::controls::FeathersSlider`.
| --- | --- | --- |
| `value` | `number` | SliderValue (min by default) |
| `min` | `number` | SliderRange's ends (0 to 1 by default) |
| `max` | `number` | – |
| `max` | `number` | SliderRange's top end (1) |
| `precision` | `number` | SliderPrecision: decimal places shown (0 by default) |
| `step` | `number` | SliderStep: a drag's or key's step |
| `disabled` | `boolean` | InteractionDisabled |
@@ -359,7 +359,7 @@ a flat table of units with scale factors, as a UnitsFormat.
Bevy: `bevy_feathers::controls::StandardUnitKind`.
Also takes the props of `String` (`toString`, `charAt`, `charCodeAt`, `concat`, `indexOf`, `lastIndexOf`, `localeCompare`, `match`, `replace`, `search`, `slice`, `split`, `substring`, `toLowerCase`, `toLocaleLowerCase`, `toUpperCase`, `toLocaleUpperCase`, `trim`, `length`, `substr`, `valueOf`, `codePointAt`, `includes`, `endsWith`, `normalize`, `repeat`, `startsWith`, `anchor`, `big`, `blink`, `bold`, `fixed`, `fontcolor`, `fontsize`, `italics`, `link`, `small`, `strike`, `sub`, `sup`, `padStart`, `padEnd`, `trimEnd`, `trimStart`, `trimLeft`, `trimRight`, `matchAll`, `replaceAll`, `at`, `isWellFormed`, `toWellFormed`, `__@iterator@151`).
Also takes the props of `String` (`toString`, `charAt`, `charCodeAt`, `concat`, `indexOf`, `lastIndexOf`, `localeCompare`, `match`, `replace`, `search`, `slice`, `split`, `substring`, `toLowerCase`, `toLocaleLowerCase`, `toUpperCase`, `toLocaleUpperCase`, `trim`, `length`, `substr`, `valueOf`, `codePointAt`, `includes`, `endsWith`, `normalize`, `repeat`, `startsWith`, `anchor`, `big`, `blink`, `bold`, `fixed`, `fontcolor`, `fontsize`, `italics`, `link`, `small`, `strike`, `sub`, `sup`, `padStart`, `padEnd`, `trimEnd`, `trimStart`, `trimLeft`, `trimRight`, `matchAll`, `replaceAll`, `at`, `isWellFormed`, `toWellFormed`, `__@iterator@155`).
### `ThemeBackgroundColor`
@@ -369,8 +369,8 @@ Bevy: `bevy_feathers::theme::ThemeBackgroundColor`.
| Prop | Type | What it does |
| --- | --- | --- |
| `token` (required) | `ThemeToken` | – |
| `children` (required) | `ReactElement` | – |
| `token` (required) | `ThemeToken` | the theme colour's token |
| `children` (required) | `ReactElement` | the one element it colours |
Used in: [ui/widgets/feathers_counter](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/feathers_counter.tsx), [ui/widgets/feathers_number_input](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/feathers_number_input.tsx), [ui/widgets/feathers_gallery](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/feathers_gallery.tsx).
@@ -382,8 +382,8 @@ Bevy: `bevy_feathers::theme::ThemeBorderColor`.
| Prop | Type | What it does |
| --- | --- | --- |
| `token` (required) | `ThemeToken` | – |
| `children` (required) | `ReactElement` | – |
| `token` (required) | `ThemeToken` | the theme colour's token |
| `children` (required) | `ReactElement` | the one element it borders |
### `ThemeContext`
@@ -393,8 +393,8 @@ Bevy: `bevy_feathers::theme::ThemeContext`.
| Prop | Type | What it does |
| --- | --- | --- |
| `level` (required) | `SurfaceLevel` | – |
| `children` | `ReactNode` | – |
| `level` (required) | `SurfaceLevel` | the surface level they sit on |
| `children` | `ReactNode` | the widgets on it |
### `ThemedText`
@@ -414,8 +414,8 @@ Bevy: `bevy_feathers::theme::ThemeTextColor`.
| Prop | Type | What it does |
| --- | --- | --- |
| `token` (required) | `ThemeToken` | – |
| `children` (required) | `ReactElement` | – |
| `token` (required) | `ThemeToken` | the theme colour's token |
| `children` (required) | `ReactElement` | the Text it colours |
### `UiTheme`
@@ -425,8 +425,8 @@ Bevy: `bevy_feathers::theme::UiTheme`.
| Prop | Type | What it does |
| --- | --- | --- |
| `theme` (required) | `ThemeProps` | – |
| `children` | `ReactNode` | – |
| `theme` (required) | `ThemeProps` | the theme's colours by token |
| `children` | `ReactNode` | the widgets that use it |
Used in: [ui/styling/box_shadow](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/styling/box_shadow.tsx), [ui/widgets/virtual_keyboard](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/virtual_keyboard.tsx), [ui/widgets/feathers_counter](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/feathers_counter.tsx), [ui/widgets/feathers_number_input](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/feathers_number_input.tsx), [ui/widgets/feathers_gallery](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/feathers_gallery.tsx), [3d/split_screen](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/split_screen.tsx), [2d/2d_shapes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/2d/2d_shapes.tsx).
@@ -440,7 +440,7 @@ Bevy: `bevy_feathers::controls::VirtualKeyboard`.
| Prop | Type | What it does |
| --- | --- | --- |
| `keys` (required) | `string[][]` | – |
| `keys` (required) | `string[][]` | the keyboard's rows, each a row of key captions |
Used in: [ui/widgets/virtual_keyboard](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/virtual_keyboard.tsx).
@@ -874,9 +874,9 @@ a feathers icon: its picture and size in px
| Field | Type | What it is |
| --- | --- | --- |
| `image` (required) | `string` | – |
| `width` (required) | `number` | – |
| `height` (required) | `number` | – |
| `image` (required) | `string` | the icon's picture |
| `width` (required) | `number` | in px |
| `height` (required) | `number` | in px |
### `FeathersListRowProps`
@@ -991,7 +991,7 @@ Bevy: `bevy_feathers::controls::UnitsFormat`.
| Field | Type | What it is |
| --- | --- | --- |
| `id` (required) | `string` | – |
| `format` (required) | `(value: NumberInputValue, editing: boolean) => string` | – |
| `id` (required) | `string` | the format's name |
| `format` (required) | `(value: NumberInputValue, editing: boolean) => string` | the value as text: for display, or for editing when \`editing\` is true |
<!-- generated:end -->
+11 -7
View File
@@ -15,7 +15,7 @@ frame you're looking at.
import { Gizmo, Overlay, overlays } from "raea/gizmos"
```
`raea/gizmos` exports 2 components, 1 function, 2 types. Bevy's counterpart: `bevy_gizmos`. Source: [sdk/raea/src/gizmos.ts](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/src/gizmos.ts).
`raea/gizmos` exports 2 components, 1 function, 3 types. Bevy's counterpart: `bevy_gizmos`. Source: [sdk/raea/src/gizmos.ts](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/src/gizmos.ts).
## Components
@@ -36,8 +36,8 @@ Its children only in a render asked for the overlay `name`.
| Prop | Type | What it does |
| --- | --- | --- |
| `name` (required) | `string` | – |
| `children` | `ReactNode` | – |
| `name` (required) | `string` | the overlay's name, as the render asks for it |
| `children` | `ReactNode` | what the overlay draws |
## Functions
@@ -68,9 +68,13 @@ type GizmoColor = string | [number, number, number, number] | { red: number; gre
| `color` | `GizmoColor \| GizmoColor[]` | one colour for every point, or one per point of `lines` (two per segment) then `strip`: "#rrggbb", Bevy's LinearRgba (above 1 for HDR, as bevy_gizmos takes it) or Srgba, or linear [r, g, b, a] |
| `width` | `number` | line width in pixels (Bevy's default 2) |
| `depthBias` | `number` | -1 always in front of geometry, 0 depth-tested as it is (Bevy's GizmoLineConfig and depth_bias) |
| `position` | `Vec3` | – |
| `rotation` | `Vec3` | – |
| `scale` | `Vec3 \| number` | – |
| `name` | `string` | – |
| `position` | `Vec3` | where it stands, metres (x, y, z) |
| `rotation` | `Vec3` | its rotation, Euler angles in radians (x, y, z) |
| `scale` | `Vec3 \| number` | its scale: one number, or x, y and z |
| `name` | `string` | the entity's name, for picking, the inspector and world.* |
### `OverlayProps`
The props of [`Overlay`](#overlay), tabled there.
<!-- generated:end -->
+13 -13
View File
@@ -61,9 +61,9 @@ Bevy: `bevy_image::texture_atlas_builder::TextureAtlasBuilder`, `bevy_image::tex
| Member | What it does |
| --- | --- |
| `.padding(p: [number, number]): TextureAtlasBuilder` | – |
| `.addTexture(src: string): TextureAtlasBuilder` | – |
| `.build({ sampler }?: { sampler?: SamplerSpec \| undefined; }): BuiltAtlas` | – |
| `.padding(p: [number, number]): TextureAtlasBuilder` | Whole px of space around each picture, [x, y]. |
| `.addTexture(src: string): TextureAtlasBuilder` | Adds a picture, packed in the order added. |
| `.build({ sampler }?: { sampler?: SamplerSpec \| undefined; }): BuiltAtlas` | Packs the atlas, with its own sampler if given (Bevy's default otherwise). |
## Types
@@ -73,9 +73,9 @@ What a <Sprite> takes to show a built atlas: the whole of it, or one of its pict
| Field | Type | What it is |
| --- | --- | --- |
| `src` (required) | `string` | – |
| `sampler` | `SamplerSpec` | – |
| `atlasPick` | `number` | – |
| `src` (required) | `string` | the atlas picture |
| `sampler` | `SamplerSpec` | how it's sampled (the atlas's own sampler) |
| `atlasPick` | `number` | which of its pictures shows (the whole atlas when left out) |
### `BuiltAtlas`
@@ -84,20 +84,20 @@ A built atlas: `image` the whole atlas as a sprite's picture, `sources.handle(te
| Field | Type | What it is |
| --- | --- | --- |
| `image` (required) | `AtlasSprite` | – |
| `sources` (required) | `{ handle(texture: string): AtlasSprite }` | – |
| `image` (required) | `AtlasSprite` | the whole atlas, as a sprite's picture |
| `sources` (required) | `{ handle(texture: string): AtlasSprite }` | \`handle(texture)\`: one of the pictures packed into it, by its file |
### `ImagePlaneProps`
| Field | Type | What it is |
| --- | --- | --- |
| `src` (required) | `string` | a picture in the media folder: staticFile("poster.png") |
| `name` | `string` | – |
| `name` | `string` | the entity's name, for picking and the inspector |
| `width` | `number` | width in scene units (1 by default); height follows the picture unless given |
| `height` | `number` | – |
| `position` | `Vec3` | – |
| `height` | `number` | in scene units (follows the picture's shape by default) |
| `position` | `Vec3` | where its centre stands, metres (x, y, z) |
| `rotation` | `Vec3` | radians |
| `scale` | `number \| Vec3` | – |
| `scale` | `number \| Vec3` | one number, or x, y and z |
| `quaternion` | `[number, number, number, number]` | a turn as a quaternion [x, y, z, w], instead of `rotation` (a card turned to face a point) |
| `shadow` | `boolean` | false: the card casts no shadow (a cursor or a UI floating in the scene); true by default |
| `cutout` | `boolean` | the picture cut out at half alpha instead of blended: its clear parts are no surface at all (no fog on them, no sorting) and its shadow is the picture's shape, not the card's. For hard-edged pictures: a baked cloud, a sprite |
@@ -113,7 +113,7 @@ The props of [`Img`](#img), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `src` (required) | `string` | a video in the media folder: staticFile("clip.mp4") |
| `name` | `string` | – |
| `name` | `string` | the entity's name, for picking, the inspector and world.* |
| `time` | `number` | the clip's time on this frame, in seconds (by default the Sequence's: frame / fps) |
| `k1` | `number` | the lens's radial distortion (SIMPLE_RADIAL's k1, from a solve): the plate is drawn undistorted, so the footage's straight lines are straight where the 3D's are |
+2 -2
View File
@@ -68,13 +68,13 @@ Bevy's 3D: cameras, lights, materials, meshes and the frame after it's drawn.
| --- | --- | --- |
| [`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/light`](light.md) | Bevy's lights in Bevy's units, environments, skies and daylight. | 15 components, 9 functions, 2 values, 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 |
| [`raea/transform`](transform.md) | Where things are: Bevy's Transform and Quat, and nesting. | 2 functions, 2 values, 4 types |
| [`raea/post_process`](post_process.md) | What's done to the frame after it's drawn: tone mapping, bloom, depth of field, motion blur, grading and outlines. | 12 components, 14 types |
| [`raea/picking`](picking.md) | What the pointer is over: the nearest part under it, and the ray it casts. | 2 functions, 3 types |
| [`raea/gizmos`](gizmos.md) | Lines drawn for looking: Bevy's gizmos and debug overlays. | 2 components, 1 function, 2 types |
| [`raea/gizmos`](gizmos.md) | Lines drawn for looking: Bevy's gizmos and debug overlays. | 2 components, 1 function, 3 types |
## 2D and UI
+28 -22
View File
@@ -31,7 +31,7 @@ function Lights() {
import { AmbientLight, Atmosphere, bounce, clearSun } from "raea/light"
```
`raea/light` exports 15 components, 9 functions, 2 values, 13 types. Bevy's counterpart: `bevy_light`. Source: [sdk/raea/src/light.ts](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/src/light.ts).
`raea/light` exports 15 components, 9 functions, 2 values, 15 types. Bevy's counterpart: `bevy_light`. Source: [sdk/raea/src/light.ts](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/src/light.ts).
## Components
@@ -44,7 +44,7 @@ Bevy: `bevy_light::ambient_light::AmbientLight`.
Takes [`AmbientLightProps`](#ambientlightprops)'s props.
Used in: [defaults/parts](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/defaults/parts.tsx), [shader_advanced/deferred_raymarch](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/shader_advanced/deferred_raymarch.tsx), [manual: turntable](https://github.com/shinyobjectz/raea/blob/main/docs/manual/examples/turntable.tsx).
Used in: [defaults/parts](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/defaults/parts.tsx), [shader_advanced/deferred_raymarch](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/shader_advanced/deferred_raymarch.tsx).
### `Atmosphere`
@@ -64,9 +64,9 @@ windows' own light comes from <WindowLight>.
| Prop | Type | What it does |
| --- | --- | --- |
| `day` (required) | `Day` | – |
| `indoor` | `number` | – |
| `softShadow` | `boolean \| number` | – |
| `day` (required) | `Day` | the day outside, from `daylight` |
| `indoor` | `number` | the room's daylight factor, the share of the outside light its bounce gives as an even fill (0.02) |
| `softShadow` | `boolean \| number` | the sun's shadow softness (0.6): true, or a number, as a DirectionalLight's |
### `DirectionalLight`
@@ -79,11 +79,11 @@ Bevy: `bevy_light::directional_light::DirectionalLight`.
| `illuminance` | `number` | lux on a surface facing it (Bevy's default 10,000, light_consts::lux::AMBIENT_DAYLIGHT; full sun is about 100,000) |
| `shadow_maps_enabled` | `boolean` | Bevy: Whether this light casts shadows. |
| `soft_shadow_size` | `number \| null` | soft shadows (PCSS): the sun's size as its shadows see it, in metres |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | Bevy components on the light: shadow settings, cascades |
Also takes the props of `LightCommon` (`color`, `name`, `visibility`, `transform`, `shadow_depth_bias`, `shadow_normal_bias`, `volumetric`).
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [3d/fog_volumes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog_volumes.tsx), [3d/shadow_caster_receiver](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/shadow_caster_receiver.tsx), [3d/split_screen](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/split_screen.tsx), [3d/pbr](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/pbr.tsx), [3d/mesh_ray_cast](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/mesh_ray_cast.tsx), [3d/atmospheric_fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/atmospheric_fog.tsx), [3d/3d_viewport_to_world](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/3d_viewport_to_world.tsx), and 16 more.
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [3d/fog_volumes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog_volumes.tsx), [3d/shadow_caster_receiver](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/shadow_caster_receiver.tsx), [3d/split_screen](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/split_screen.tsx), [3d/pbr](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/pbr.tsx), [3d/mesh_ray_cast](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/mesh_ray_cast.tsx), [3d/atmospheric_fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/atmospheric_fog.tsx), [3d/3d_viewport_to_world](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/3d_viewport_to_world.tsx), and 15 more.
### `Environment`
@@ -114,8 +114,6 @@ Used in: [3d/rotate_environment_map](https://github.com/shinyobjectz/raea/blob/m
The same light as a resource, as Bevy 0.20 names it. (A function, not a const alias: an alias would keep 3D code in
a 2D bundle through the prelude.)
Bevy: `bevy_light::GlobalAmbientLight`.
Takes [`AmbientLightProps`](#ambientlightprops)'s props.
Used in: [3d/fog_volumes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog_volumes.tsx), [3d/fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog.tsx), [3d/spherical_area_lights](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spherical_area_lights.tsx), [3d/lightmaps](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/lightmaps.tsx), [3d/spotlight](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spotlight.tsx), [animation/animated_mesh](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/animation/animated_mesh.tsx), [animation/animated_transform](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/animation/animated_transform.tsx), [gltf/gltf_skinned_mesh](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/gltf/gltf_skinned_mesh.tsx).
@@ -224,12 +222,12 @@ A window's light as a lamp (windowLight), wide and soft, shadowed.
| Prop | Type | What it does |
| --- | --- | --- |
| `day` (required) | `Day` | – |
| `room` (required) | `Room` | – |
| `opening` (required) | `Opening` | – |
| `transmit` | `number` | – |
| `ground` | `number` | – |
| `name` | `string` | – |
| `day` (required) | `Day` | the day outside |
| `room` (required) | `Room` | the room the window is in |
| `opening` (required) | `Opening` | the window: one of the room's openings |
| `transmit` | `number` | the share of light the glass lets through (0.75) |
| `ground` | `number` | the ground's reflectance outside (0.2) |
| `name` | `string` | the light's name (window-WALL-AT by default) |
## Functions
@@ -335,8 +333,8 @@ Lights are given in Bevy's own units.
| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | – |
| `color` | `string` | – |
| `name` | `string` | the entity's name, for picking, the inspector and world.* |
| `color` | `string` | its colour, as CSS writes one (a name, hex, rgb()) |
| `brightness` | `number` | cd/m² (Bevy's default 80) |
### `AtmosphereProps`
@@ -352,18 +350,22 @@ The day outside, in physical units, for one set.
| Field | Type | What it is |
| --- | --- | --- |
| `sky` (required) | `string` | – |
| `sky` (required) | `string` | the sky panorama's file |
| `rotation` (required) | `number` | the panorama's turn that puts its sun where the day's is (radians, as <Environment rotation>) |
| `sunDir` (required) | `Vec3` | toward the sun, world |
| `sunLux` (required) | `number` | the sun's lux on a surface facing it, its colour temperature |
| `sunK` (required) | `number` | – |
| `sunK` (required) | `number` | the sun's colour temperature, kelvin |
| `sunGround` (required) | `number` | the sun's and the sky's lux on level ground outside |
| `skyGround` (required) | `number` | – |
| `skyGround` (required) | `number` | the sky's lux on level ground outside |
| `skyNits` (required) | `number` | the sky's mean luminance (cd/m²) and colour temperature |
| `skyK` (required) | `number` | – |
| `skyK` (required) | `number` | the sky's colour temperature, kelvin |
| `scale` (required) | `number` | cd/m² per unit of the panorama |
| `elevation` (required) | `number` | the sun's elevation (degrees) the light was made for, and the panorama's own (a different height shows in its shadows' length outside, never in the room's light) |
| `skyElevation` (required) | `number \| null` | – |
| `skyElevation` (required) | `number \| null` | the panorama's own sun elevation, degrees (null for an overcast one) |
### `DaylightProps`
The props of [`Daylight`](#daylight), tabled there.
### `DirectionalLightProps`
@@ -429,4 +431,8 @@ The props of [`SolariLighting`](#solarilighting), tabled there.
The props of [`SpotLight`](#spotlight), tabled there.
### `WindowLightProps`
The props of [`WindowLight`](#windowlight), tabled there.
<!-- generated:end -->
+16 -16
View File
@@ -139,31 +139,31 @@ type ExtrapolateMode = "extend" | "clamp" | "identity" | "wrap"
| Field | Type | What it is |
| --- | --- | --- |
| `easing` | `EasingFn \| EasingFn[]` | – |
| `extrapolateLeft` | `ExtrapolateMode` | – |
| `extrapolateRight` | `ExtrapolateMode` | – |
| `easing` | `EasingFn \| EasingFn[]` | the curve between keyframes: one for all, or one a segment |
| `extrapolateLeft` | `ExtrapolateMode` | below the first keyframe: extend the line (default), clamp to it, identity (the input itself) or wrap |
| `extrapolateRight` | `ExtrapolateMode` | past the last keyframe: extend (default), clamp, identity or wrap |
### `SpringConfig`
| Field | Type | What it is |
| --- | --- | --- |
| `mass` | `number` | – |
| `damping` | `number` | – |
| `stiffness` | `number` | – |
| `overshootClamping` | `boolean` | – |
| `mass` | `number` | how heavy the spring's weight is (1): heavier is slower and swings further |
| `damping` | `number` | how fast the swing dies (10): lower bounces more |
| `stiffness` | `number` | how hard the spring pulls (100): stiffer is quicker |
| `overshootClamping` | `boolean` | stop at `to` the first time it gets there, with no overshoot (false) |
### `SpringOptions`
| Field | Type | What it is |
| --- | --- | --- |
| `frame` (required) | `number` | – |
| `fps` (required) | `number` | – |
| `from` | `number` | – |
| `to` | `number` | – |
| `config` | `SpringConfig` | – |
| `durationInFrames` | `number` | – |
| `durationRestThreshold` | `number` | – |
| `delay` | `number` | – |
| `reverse` | `boolean` | – |
| `frame` (required) | `number` | the frame to sample, usually useCurrentFrame() |
| `fps` (required) | `number` | frames a second, from useVideoConfig() |
| `from` | `number` | the value it starts at (0) |
| `to` | `number` | the value it settles at (1) |
| `config` | `SpringConfig` | the spring: mass, damping, stiffness, overshootClamping |
| `durationInFrames` | `number` | stretch or squeeze the spring to settle in this many frames |
| `durationRestThreshold` | `number` | how close to `to`, as a share of the travel, counts as settled when timing it (0.005) |
| `delay` | `number` | frames before it starts (0) |
| `reverse` | `boolean` | play it backwards: from `to` back to `from` |
<!-- generated:end -->
+82 -91
View File
@@ -76,15 +76,9 @@ Also takes the props of [`ConicalFrustumProps`](#conicalfrustumprops) (`radius_t
Bevy's Cuboid: `<Cuboid half_size={[1, 0.5, 1]} />` is a Box of args [2, 1, 2].
Bevy: `bevy_shape::Cuboid`.
Also takes the props of [`CuboidProps`](3d.md#cuboidprops) (`half_size`); `BoxProps` (`args`).
| Prop | Type | What it does |
| --- | --- | --- |
| `args` | `[number, number, number]` | – |
Also takes the props of [`CuboidProps`](3d.md#cuboidprops) (`half_size`).
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/widgets/viewport_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/viewport_node.tsx), [3d/fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog.tsx), [3d/transparency_3d](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx), [3d/animated_material](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/animated_material.tsx), [3d/two_passes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/two_passes.tsx), [3d/spotlight](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spotlight.tsx), [3d/orthographic](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/orthographic.tsx), and 34 more.
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/widgets/viewport_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/viewport_node.tsx), [3d/fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog.tsx), [3d/transparency_3d](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx), [3d/animated_material](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/animated_material.tsx), [3d/two_passes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/two_passes.tsx), [3d/spotlight](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spotlight.tsx), [3d/orthographic](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/orthographic.tsx), and 33 more.
### `Cylinder`
@@ -124,13 +118,13 @@ shadow="only" draws it with the shadow-only material (engine/render shadow_only.
| Prop | Type | What it does |
| --- | --- | --- |
| `transform` | `TransformValue` | – |
| `transform` | `TransformValue` | where it stands: translation, rotation (a quaternion) and scale, as Bevy's Transform |
| `visibility` | `"Visible" \| "Hidden" \| "Inherited"` | Bevy's Visibility: "Hidden" draws nothing; "Visible" and "Inherited" draw |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | its material and child entities |
Also takes the props of `MeshProps` (`animate`, `name`, `pass`, `quaternion`, `allowOverlap`, `posed`, `shape`, `driven`, `shadow`, `material`, `castShadow`, `surface`, `receiveShadow`, `attributes`, `compressed`, `layers`); `PointerHandlers3d` (`onClick`, `onDrag`, `onDragEnd`, `onDragEnter`, `onDragLeave`, `onDragOver`, `onDragStart`, `onDrop`, `onPointerDown`, `onPointerMove`, `onPointerUp`, `onPointerEnter`, `onPointerLeave`, `onPointerOver`, `onPointerOut`, `onWheel`).
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/widgets/viewport_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/viewport_node.tsx), [3d/fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog.tsx), [3d/vertex_colors](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/vertex_colors.tsx), [3d/rotate_environment_map](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/rotate_environment_map.tsx), [3d/transparency_3d](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx), [3d/spherical_area_lights](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spherical_area_lights.tsx), [3d/animated_material](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/animated_material.tsx), and 54 more.
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/widgets/viewport_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/viewport_node.tsx), [3d/fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog.tsx), [3d/vertex_colors](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/vertex_colors.tsx), [3d/rotate_environment_map](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/rotate_environment_map.tsx), [3d/transparency_3d](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx), [3d/spherical_area_lights](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spherical_area_lights.tsx), [3d/animated_material](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/animated_material.tsx), and 53 more.
### `MeshSequence`
@@ -148,8 +142,6 @@ Used in: [3d/vertex_colors](https://github.com/shinyobjectz/raea/blob/main/sdk/r
### `Sphere`
*From Bevy's `bevy_shape::Sphere`:* A sphere primitive, representing the set of all points some distance from the origin
Also takes the props of [`SphereProps`](3d.md#sphereprops) (`args`, `radius`, `ico`, `uv`).
Used in: [3d/fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog.tsx), [3d/rotate_environment_map](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/rotate_environment_map.tsx), [3d/transparency_3d](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx), [3d/spherical_area_lights](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spherical_area_lights.tsx), [3d/shadow_caster_receiver](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/shadow_caster_receiver.tsx), [3d/pbr](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/pbr.tsx), [3d/spotlight](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spotlight.tsx), [3d/rect_light](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/rect_light.tsx), and 7 more.
@@ -181,13 +173,12 @@ area and bounds. Offset, combine and move it, then extrude or revolve it into a
| Member | What it does |
| --- | --- |
| `new CrossSection(a: SectionAnswer)` | – |
| `CrossSection.from(a: SectionAnswer): CrossSection` | From an engine answer (a slice, a projection, an operation). |
| `CrossSection.of(polygons: Polygons): CrossSection` | Contours, overlaps merged and self-crossings resolved (Manifold's positive fill rule). |
| `.polygons: Polygons` | – |
| `.area: number` | – |
| `.contours: number` | – |
| `.bounds: { min: [number, number]; max: [number, number]; }` | – |
| `.polygons: Polygons` | its contours, each a list of [x, y] points: counter-clockwise solid, clockwise holes |
| `.area: number` | its area, m² |
| `.contours: number` | how many contours it has |
| `.bounds: { min: [number, number]; max: [number, number]; }` | its bounding box's low and high corners |
| `.union(...others: CrossSection[]): CrossSection` | This and the others together. |
| `.minus(...others: CrossSection[]): CrossSection` | This with the others cut away. |
| `.intersect(...others: CrossSection[]): CrossSection` | Only where this and every other overlap. |
@@ -211,8 +202,8 @@ A handle to a native solid. Free it when done with many (or let the run end).
| Member | What it does |
| --- | --- |
| `new Solid(id: number, expr: string)` | – |
| `.id: number` | – |
| `new Solid(id: number, expr: string)` | A handle to native solid `id`, which `expr` rebuilds; the shape functions make these, rarely you. |
| `.id: number` | the native solid's handle |
| `.expr: string` | the expression that rebuilds this solid (what a mesh row draws) |
| `.union(...others: Solid[]): Solid` | This and the others together. |
| `.minus(...others: Solid[]): Solid` | This with the others cut away. |
@@ -312,8 +303,8 @@ type Animate3d = Record<string, TrackSpec | TrackSpec[] | Keys> | Move
| Field | Type | What it is |
| --- | --- | --- |
| `min` (required) | `Vec3` | – |
| `max` (required) | `Vec3` | – |
| `min` (required) | `Vec3` | the low corner |
| `max` (required) | `Vec3` | the high corner |
### `BufferMeshProps`
@@ -332,23 +323,23 @@ Bevy's Capsule3d: radius and half_length, the straight part's half (0.5 each by
| Field | Type | What it is |
| --- | --- | --- |
| `radius` | `number` | – |
| `half_length` | `number` | – |
| `args` | `[number, number]` | – |
| `radius` | `number` | metres (0.5) |
| `half_length` | `number` | half the straight part's length, metres (0.5) |
| `args` | `[number, number]` | [radius, length of the straight part] |
### `CapsuleProps`
| Field | Type | What it is |
| --- | --- | --- |
| `args` | `[number, number]` | – |
| `args` | `[number, number]` | [radius, length of the straight part] ([0.5, 1]) |
### `ConeProps`
| Field | Type | What it is |
| --- | --- | --- |
| `args` | `[number, number]` | – |
| `radius` | `number` | – |
| `height` | `number` | – |
| `args` | `[number, number]` | [radius, height] |
| `radius` | `number` | the base's radius, metres (0.5) |
| `height` | `number` | metres (1) |
### `ConicalFrustumProps`
@@ -357,10 +348,10 @@ height (0.5), standing up: a tapered Cylinder of args [radius_top, radius_bottom
| Field | Type | What it is |
| --- | --- | --- |
| `radius_top` | `number` | – |
| `radius_bottom` | `number` | – |
| `height` | `number` | – |
| `args` | `[number, number, number]` | – |
| `radius_top` | `number` | the top end's radius, metres (0.25) |
| `radius_bottom` | `number` | the bottom end's radius, metres (0.5) |
| `height` | `number` | metres (0.5) |
| `args` | `[number, number, number]` | [radius_top, radius_bottom, height] |
### `CuboidProps`
@@ -368,7 +359,7 @@ Bevy's Cuboid: half its size along each axis ([0.5, 0.5, 0.5], a 1 m cube, as Be
| Field | Type | What it is |
| --- | --- | --- |
| `half_size` | `[number, number, number]` | – |
| `half_size` | `[number, number, number]` | half its size along x, y and z, metres ([0.5, 0.5, 0.5]) |
### `CylinderProps`
@@ -376,9 +367,9 @@ Bevy's Cuboid: half its size along each axis ([0.5, 0.5, 0.5], a 1 m cube, as Be
| Field | Type | What it is |
| --- | --- | --- |
| `args` | `[number, number, number]` | – |
| `radius` | `number` | – |
| `half_height` | `number` | – |
| `args` | `[number, number, number]` | [radius top, radius bottom, height], as three.js's args |
| `radius` | `number` | metres (0.5) |
| `half_height` | `number` | half its height, metres (0.5) |
### `Instance`
@@ -387,9 +378,9 @@ copy together). Rotation in radians, XYZ order, as everywhere.
| Field | Type | What it is |
| --- | --- | --- |
| `position` (required) | `Vec3` | – |
| `rotation` | `Vec3` | – |
| `scale` | `number \| Vec3` | – |
| `position` (required) | `Vec3` | where this copy stands, metres, in the Instances' space |
| `rotation` | `Vec3` | its rotation, Euler angles in radians (x, y, z) |
| `scale` | `number \| Vec3` | its scale: one number, or x, y and z |
### `InstancesProps`
@@ -397,41 +388,41 @@ copy together). Rotation in radians, XYZ order, as everywhere.
| --- | --- | --- |
| `src` | `string` | a glTF file drawn at every placement: staticFile("models/house.glb"). Without it, a geometry child (or `shape`) and a material child draw a mesh at every placement |
| `at` (required) | `Instance[]` | where each copy stands. Fixed for the shot: the first frame's list is drawn on every frame (move, turn, scale, hide or recolour the whole set by the Instances' own props) |
| `name` | `string` | – |
| `position` | `Vec3` | – |
| `name` | `string` | the entity's name, for picking, the inspector and world.* |
| `position` | `Vec3` | where it stands, metres (x, y, z) |
| `rotation` | `Vec3` | radians |
| `scale` | `number \| Vec3` | – |
| `scale` | `number \| Vec3` | its scale: one number, or x, y and z |
| `scene` | `number` | of a glTF: which of its scenes (0 by default) |
| `shape` | `string \| Solid` | a Manifold solid or its expression for the mesh form; wins over the geometry child |
| `shadow` | `boolean` | false: the copies cast no shadow (true by default). Grass and flowers by the thousand usually want false |
| `receiveShadow` | `boolean` | false: no shadow falls on the copies |
| `pass` | `string` | – |
| `pass` | `string` | the composition pass it draws in ("scene" by default) |
| `children` | `ReactNode` | the mesh form: a geometry and a material (MeshStandardMaterial, MeshPhysicalMaterial or MeshBasicMaterial). The glTF form: MeshStandardMaterial children re-covering its materials, as on a Model |
### `Mesh2dProps`
| Field | Type | What it is |
| --- | --- | --- |
| `transform` | `TransformValue` | – |
| `visibility` | `"Inherited" \| "Visible" \| "Hidden"` | – |
| `transform` | `TransformValue` | where it stands: translation, rotation (a quaternion) and scale |
| `visibility` | `"Inherited" \| "Visible" \| "Hidden"` | "Hidden" draws nothing; "Visible" and "Inherited" draw |
| `children` | `ReactNode` | one of bevy_math's 2D primitives (<Circle>, <Capsule2d>,...) and a <ColorMaterial>, or your own <Material> |
| `name` | `string` | – |
| `onClick` | `(e: Event3d) => void` | – |
| `onDrag` | `(e: Event3d) => void` | – |
| `onDragEnd` | `(e: Event3d) => void` | – |
| `onDragEnter` | `(e: Event3d) => void` | – |
| `onDragLeave` | `(e: Event3d) => void` | – |
| `onDragOver` | `(e: Event3d) => void` | – |
| `onDragStart` | `(e: Event3d) => void` | – |
| `onDrop` | `(e: Event3d) => void` | – |
| `onPointerDown` | `(e: Event3d) => void` | – |
| `onPointerMove` | `(e: Event3d) => void` | – |
| `onPointerUp` | `(e: Event3d) => void` | – |
| `onPointerEnter` | `(e: Event3d) => void` | – |
| `onPointerLeave` | `(e: Event3d) => void` | – |
| `onPointerOver` | `(e: Event3d) => void` | – |
| `onPointerOut` | `(e: Event3d) => void` | – |
| `onWheel` | `(e: Event3d) => void` | – |
| `name` | `string` | the entity's name, for picking, the inspector and world.* |
| `onClick` | `(e: Event3d) => void` | a press and release over the part |
| `onDrag` | `(e: Event3d) => void` | the part pressed is being dragged, each frame it moves |
| `onDragEnd` | `(e: Event3d) => void` | the drag of the part pressed ended |
| `onDragEnter` | `(e: Event3d) => void` | a dragged part came over this one (`dragged` names it) |
| `onDragLeave` | `(e: Event3d) => void` | a dragged part left this one |
| `onDragOver` | `(e: Event3d) => void` | a dragged part is over this one |
| `onDragStart` | `(e: Event3d) => void` | a drag began on the part pressed |
| `onDrop` | `(e: Event3d) => void` | a dragged part was dropped on this one |
| `onPointerDown` | `(e: Event3d) => void` | a button pressed over the part |
| `onPointerMove` | `(e: Event3d) => void` | the pointer moved over the part |
| `onPointerUp` | `(e: Event3d) => void` | a button released over the part |
| `onPointerEnter` | `(e: Event3d) => void` | the pointer came over the part (doesn't bubble) |
| `onPointerLeave` | `(e: Event3d) => void` | the pointer left the part (doesn't bubble) |
| `onPointerOver` | `(e: Event3d) => void` | the pointer came over the part (bubbles, as the DOM's) |
| `onPointerOut` | `(e: Event3d) => void` | the pointer left the part (bubbles) |
| `onWheel` | `(e: Event3d) => void` | the wheel turned over the part (`deltaX`, `deltaY`) |
| `quat` | `Quat` | Bevy's rotation as it is, a quaternion [x, y, z, w] in Bevy's axes (y up, z toward the viewer), in place of `rotation`: a turn out of the frame's plane too, as a Sprite's Transform takes it (camera/2d_on_ui) |
| `opacity` | `number` | 0 to 1 (1 by default) |
@@ -451,27 +442,27 @@ type MeshAttribute = [MeshVertexAttribute, (number | number[])[]]
| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | – |
| `name` | `string` | the entity's name, for picking and the inspector |
| `src` (required) | `string` | a.rseq (tools/goo writes them; raea_render::meshseq) |
| `frame` (required) | `number` | which of its frames (clamped) |
| `position` | `Vec3` | – |
| `rotation` | `Vec3` | – |
| `scale` | `number` | – |
| `position` | `Vec3` | where it stands, metres (x, y, z) |
| `rotation` | `Vec3` | its rotation, Euler angles in radians (x, y, z) |
| `scale` | `number` | a uniform scale |
| `color` | `string` | multiplies the vertex colours |
| `roughness` | `number` | – |
| `metalness` | `number` | – |
| `clearcoat` | `number` | – |
| `clearcoatRoughness` | `number` | – |
| `roughness` | `number` | 0..1, smooth to matte |
| `metalness` | `number` | 0..1, a dielectric to a metal |
| `clearcoat` | `number` | 0..1 strength of a clear varnish layer over the surface |
| `clearcoatRoughness` | `number` | 0..1 roughness of that clear layer |
| `reflectance` | `number` | 0..1 specular strength at normal incidence (0.5: 4%, a dielectric's) |
| `subsurface` | `number` | 0..1 light let through (diffuse transmission): a jelly's glow |
| `thickness` | `number` | – |
| `thickness` | `number` | how thick the mesh is, metres, for the light let through |
| `transmission` | `number` | 0..1 light let straight through and bent (a clear liquid: water, tea, juice), with its index of refraction (1.33 water) and, for a tinted one, the colour it takes after `attenuationDistance` metres through it. Screen space: it refracts what's on screen behind it, and one clear layer doesn't show another through it |
| `ior` | `number` | – |
| `attenuationColor` | `string` | – |
| `attenuationDistance` | `number` | – |
| `opacity` | `number` | – |
| `ior` | `number` | the index of refraction of what light passes through (1.33 water) |
| `attenuationColor` | `string` | the colour light takes after `attenuationDistance` metres through it |
| `attenuationDistance` | `number` | metres through it until light has taken `attenuationColor` |
| `opacity` | `number` | 0..1, see-through to solid |
| `map` | `string` | a picture over its texture coordinates |
| `doubleSided` | `boolean` | – |
| `doubleSided` | `boolean` | draw the back faces too (an open shell, a petal) |
### `PlanBox`
@@ -479,8 +470,8 @@ A box on the plan (x, z, metres): the room SDK's Footprint, or any { min, max }.
| Field | Type | What it is |
| --- | --- | --- |
| `min` (required) | `[number, number]` | – |
| `max` (required) | `[number, number]` | – |
| `min` (required) | `[number, number]` | the low corner (x, z), metres |
| `max` (required) | `[number, number]` | the high corner (x, z), metres |
### `Plane3dProps`
@@ -490,8 +481,8 @@ its two axes ([0.5, 0.5]), laid out as Bevy's PlaneMeshBuilder does: facing +Z i
| Field | Type | What it is |
| --- | --- | --- |
| `normal` | `Vec3` | – |
| `half_size` | `[number, number]` | – |
| `normal` | `Vec3` | the way it faces, along an axis (+Y by default, a floor) |
| `half_size` | `[number, number]` | half its extent along its two axes, metres ([0.5, 0.5]) |
### `Polygons`
@@ -524,9 +515,9 @@ A cross-section of a solid at a height: its area, how many contours, and the con
| Field | Type | What it is |
| --- | --- | --- |
| `area` (required) | `number` | – |
| `contours` (required) | `number` | – |
| `polygons` (required) | `[number, number][][]` | – |
| `area` (required) | `number` | the section's area, m² |
| `contours` (required) | `number` | how many outlines it has |
| `polygons` (required) | `[number, number][][]` | the outlines, each a list of [x, y] points in the section's plane |
### `SphereProps`
@@ -535,10 +526,10 @@ subdivisions, or `ico` of them (Bevy's `.ico(n)`, 0 to 80), or a UV sphere of `u
| Field | Type | What it is |
| --- | --- | --- |
| `args` | `[number]` | – |
| `radius` | `number` | – |
| `ico` | `number` | – |
| `uv` | `[number, number]` | – |
| `args` | `[number]` | [radius], as three.js's args |
| `radius` | `number` | metres (0.5) |
| `ico` | `number` | an icosphere of this many subdivisions (5 by default; 0 to 80) |
| `uv` | `[number, number]` | a UV sphere instead: [sectors, stacks] |
### `TorusProps`
@@ -546,9 +537,9 @@ subdivisions, or `ico` of them (Bevy's `.ico(n)`, 0 to 80), or a UV sphere of `u
| Field | Type | What it is |
| --- | --- | --- |
| `args` | `[number, number]` | – |
| `major_radius` | `number` | – |
| `minor_radius` | `number` | – |
| `args` | `[number, number]` | [major radius, minor radius] |
| `major_radius` | `number` | from the centre to the middle of the tube, metres (0.75) |
| `minor_radius` | `number` | the tube's radius, metres (0.25) |
### `Vec3`
+143 -143
View File
@@ -60,6 +60,8 @@ Bevy's ExtendedMaterial: a StandardMaterial with one of raea's extensions (GridE
<ExtendedMaterial base={<StandardMaterial base_color="#cfc8bb" />} extension={<GridExtension cell={0.5} major={2} />} />
Bevy: `bevy_pbr::ExtendedMaterial`.
| Prop | Type | What it does |
| --- | --- | --- |
| `base` (required) | `ReactElement` | a <StandardMaterial>, or another <ExtendedMaterial> to put a second extension on (grid and paint both) |
@@ -108,10 +110,10 @@ Bevy: `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::Exte
| Prop | Type | What it does |
| --- | --- | --- |
| `cell` (required) | `number` | – |
| `major` | `number` | – |
| `color` | `string` | – |
| `edge` | `string` | – |
| `cell` (required) | `number` | world units between grid lines |
| `major` | `number` | cells between heavier lines (4) |
| `color` | `string` | the lines' colour |
| `edge` | `string` | the colour each Box face is outlined in ("" for none) |
### `Lightmap`
@@ -134,10 +136,10 @@ Used in: [3d/lightmaps](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/
| Prop | Type | What it does |
| --- | --- | --- |
| `breakup` | `number` | – |
| `scale` | `number` | – |
| `color` | `string` | – |
| `amount` | `number` | – |
| `breakup` | `number` | how far tone boundaries wander (0.5) |
| `scale` | `number` | the noise's size in metres (1) |
| `color` | `string` | the colour patches take |
| `amount` | `number` | how far toward `color` the patches go (0.6) |
### `ProceduralExtension`
@@ -149,21 +151,21 @@ Bevy: `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::Exte
| Prop | Type | What it does |
| --- | --- | --- |
| `pattern` (required) | `ProceduralSurface["pattern"]` | – |
| `colors` | `[string, string]` | – |
| `scale` | `number` | – |
| `rough_a` | `number` | – |
| `rough_b` | `number` | – |
| `bump` | `number` | – |
| `tile` | `[number, number]` | – |
| `gap` | `number` | – |
| `gap_color` | `string` | – |
| `dust` | `number` | – |
| `dirt` | `number` | – |
| `edges` | `number` | – |
| `dust_color` | `string` | – |
| `dirt_color` | `string` | – |
| `seed` | `number` | – |
| `pattern` (required) | `ProceduralSurface["pattern"]` | what it draws: noise, wood, marble, stone, brick, tiles, fabric, brushed or plaster |
| `colors` | `[string, string]` | the pattern's two colours |
| `scale` | `number` | how many metres across its features are |
| `rough_a` | `number` | the first colour's roughness, 0..1 |
| `rough_b` | `number` | the second colour's roughness, 0..1 |
| `bump` | `number` | how deep the pattern's relief looks (0 or more) |
| `tile` | `[number, number]` | brick and tiles: a cell's [width, height] in metres |
| `gap` | `number` | brick and tiles: the joints' width in metres |
| `gap_color` | `string` | the joints' colour |
| `dust` | `number` | 0..1 dust on what faces up |
| `dirt` | `number` | 0..1 dirt in joints, hollows, undersides and along the floor line |
| `edges` | `number` | 0..1 wear on the edges, lighter |
| `dust_color` | `string` | the dust's colour |
| `dirt_color` | `string` | the dirt's colour |
| `seed` | `number` | which randomness the pattern uses |
### `Refinish`
@@ -173,8 +175,8 @@ colour, texture or finish each gives, the rest of it kept (a run of cabinets pai
| Prop | Type | What it does |
| --- | --- | --- |
| `materials` (required) | `MeshStandardMaterialProps[]` | – |
| `children` | `ReactNode` | – |
| `materials` (required) | `MeshStandardMaterialProps[]` | the finishes, each a <MeshStandardMaterial>'s props, over every glTF material or the one its `material` names |
| `children` | `ReactNode` | the models refinished |
### `ShaderExtension`
@@ -212,7 +214,7 @@ Bevy: `bevy_pbr::pbr_material::StandardMaterial`.
Also takes the props of [`StandardMaterialProps`](#standardmaterialprops).
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/widgets/viewport_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/viewport_node.tsx), [3d/fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog.tsx), [3d/vertex_colors](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/vertex_colors.tsx), [3d/rotate_environment_map](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/rotate_environment_map.tsx), [3d/transparency_3d](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx), [3d/spherical_area_lights](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spherical_area_lights.tsx), [3d/lightmaps](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/lightmaps.tsx), and 42 more.
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/widgets/viewport_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/viewport_node.tsx), [3d/fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog.tsx), [3d/vertex_colors](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/vertex_colors.tsx), [3d/rotate_environment_map](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/rotate_environment_map.tsx), [3d/transparency_3d](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx), [3d/spherical_area_lights](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spherical_area_lights.tsx), [3d/lightmaps](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/lightmaps.tsx), and 41 more.
### `SurfaceShader`
@@ -274,15 +276,15 @@ Bevy: `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::Exte
| Prop | Type | What it does |
| --- | --- | --- |
| `amount` (required) | `number` | – |
| `scale` | `number` | – |
| `chips` | `number` | – |
| `grime` | `number` | – |
| `rust` | `number` | – |
| `seed` | `number` | – |
| `chip_color` | `string` | – |
| `grime_color` | `string` | – |
| `rust_color` | `string` | – |
| `amount` (required) | `number` | how worn it is, 0-1 |
| `scale` | `number` | a blotch's size in metres (0.08) |
| `chips` | `number` | chips on edges and a few spots, 0-1 of the wear (0.6) |
| `grime` | `number` | grime low and underneath, 0-1 of the wear (0.5) |
| `rust` | `number` | rust run down in streaks, 0-1 of the wear (0.25) |
| `seed` | `number` | moves the pattern |
| `chip_color` | `string` | what chips show beneath the paint |
| `grime_color` | `string` | the grime's colour |
| `rust_color` | `string` | the rust's colour |
## Functions
@@ -300,8 +302,6 @@ function volumeShadow(owner: string, v: unknown): number
FogFalloff's constructors: the visibility distance (5% contrast left at it by default) to a density
Bevy: `bevy_pbr::FogFalloff`.
Used in: [3d/atmospheric_fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/atmospheric_fog.tsx).
## Types
@@ -326,18 +326,18 @@ type AlphaMode = "Opaque" | "Blend" | "Premultiplied" | "Add" | "Multiply" | "Al
| Field | Type | What it is |
| --- | --- | --- |
| `src` (required) | `string` | the picture pressed onto the surface: staticFile("label.png"); its clear parts show the surface through |
| `name` | `string` | – |
| `normalMap` | `string` | – |
| `name` | `string` | the entity's name, for picking, the inspector and world.* |
| `normalMap` | `string` | a normal map pressed with the picture: the label's relief |
| `size` | `number \| [number, number]` | width by height in metres (a number: a square) |
| `position` | `Vec3` | – |
| `position` | `Vec3` | where it stands, metres (x, y, z) |
| `normal` | `Vec3` | which way the surface faces at the decal (out of it; [0, 1, 0], a floor or counter, by default): turns the decal so the picture lies on it, upright on a wall, its top toward -z on a floor. Instead of rotation |
| `spin` | `number` | a turn about the normal (radians) |
| `rotation` | `Vec3` | radians, the decal's +y out of the surface (rather than normal) |
| `color` | `string` | a tint times the picture (keyed: a stain darkening) |
| `opacity` | `number` | 0 to 1 (keyed: a label fading in) |
| `roughness` | `number` | – |
| `metalness` | `number` | – |
| `unlit` | `boolean` | – |
| `roughness` | `number` | 0..1, smooth to matte |
| `metalness` | `number` | 0..1, a dielectric to a metal |
| `unlit` | `boolean` | drawn in its flat colour, without light or shade |
| `fade` | `number` | how far off its plane (metres) it still lies on a surface, fading to nothing there (0.05 by default). Anything nearer the plane than this takes it, a cabinet's side or a fridge's as well as the wall: keep it small |
### `ExtendedMaterialProps`
@@ -366,7 +366,7 @@ The props of [`ExtendedMaterial`](#extendedmaterial), tabled there.
| --- | --- | --- |
| `color` | `FogColor` | what far things fade into: match the background |
| `near` | `number` | linear fog from `near` to `far` (in the Canvas3D 5 and 20 by default; on the camera Bevy's 0 and 100) |
| `far` | `number` | – |
| `far` | `number` | where linear fog is full, from the camera (20 in the Canvas3D, 100 on a camera) |
| `density` | `number` | or exponential fog of this density (0.05-0.3), instead of near and far |
| `falloff` | `FogFalloff` | on the camera: Bevy's FogFalloff, in place of near, far and density (Bevy's default Linear 0 to 100) |
| `directional_light_color` | `FogColor` | on the camera: the sun's colour in the fog looking towards it, its alpha its strength (Bevy's default none) |
@@ -409,8 +409,8 @@ its green, the metalness map's as its blue (white without one, so metallic is it
| Field | Type | What it is |
| --- | --- | --- |
| `roughness` | `string` | – |
| `metalness` | `string` | – |
| `roughness` | `string` | a greyscale roughness map (white rough) |
| `metalness` | `string` | a greyscale metalness map (white metal) |
### `PaintExtensionProps`
@@ -439,8 +439,8 @@ ImageSamplerDescriptor ({ path: "checker.png", sampler: { filter: "nearest" } }
| Field | Type | What it is |
| --- | --- | --- |
| `path` (required) | `string` | – |
| `sampler` (required) | `SamplerSpec` | – |
| `path` (required) | `string` | the picture, in the media folder |
| `sampler` (required) | `SamplerSpec` | how it's sampled: filter, address modes |
### `ShaderExtensionProps`
@@ -463,12 +463,12 @@ The props of [`ShaderExtension`](#shaderextension), tabled there.
| `uniforms` | `Record<string, number \| number[] \| string>` | up to 16: a number (f32), [x, y], [x, y, z], [x, y, z, w] or "#rrggbb" (a linear vec4) |
| `textures` | `Record<string, string \| Record<string, unknown>>` | up to 4: an asset path, a picture made in code ({ width, height, pixels }) or "render:NAME"; and one array, { layers: [picture,...] } or { src, layers: N }, read as texture_2d_array<f32> tex_NAME by layer |
| `defs` | `ShaderDefs` | shader defs: each NAME a WESL condition for `@if(NAME)`, and a whole number also `constants::NAME` |
| `alpha` | `"opaque" \| "blend" \| "add" \| "premultiplied"` | – |
| `doubleSided` | `boolean` | – |
| `name` | `string` | – |
| `position` | `Vec3` | – |
| `rotation` | `Vec3` | – |
| `scale` | `Vec3 \| number` | – |
| `alpha` | `"opaque" \| "blend" \| "add" \| "premultiplied"` | how it blends: opaque, blend, add or premultiplied |
| `doubleSided` | `boolean` | draw the back faces too |
| `name` | `string` | the entity's name, for picking, the inspector and world.* |
| `position` | `Vec3` | where it stands, metres (x, y, z) |
| `rotation` | `Vec3` | its rotation, Euler angles in radians (x, y, z) |
| `scale` | `Vec3 \| number` | its scale: one number, or x, y and z |
### `SplatMorph`
@@ -484,18 +484,18 @@ The props of [`ShaderExtension`](#shaderextension), tabled there.
| --- | --- | --- |
| `name` | `string` | parts are matched by name across frames: name a splat that comes and goes |
| `src` (required) | `string` | the splat file (staticFile("x.ply")): a 3DGS.ply (spherical harmonics up to degree 3), a.splat or a.spz. A `x.ply.json` beside it (raea splat train writes one) places it: +Y up, centred, metres |
| `position` | `Vec3` | – |
| `position` | `Vec3` | where it stands, metres (x, y, z) |
| `rotation` | `Vec3` | radians, Euler XYZ |
| `scale` | `number \| Vec3` | – |
| `scale` | `number \| Vec3` | its scale: one number, or x, y and z |
| `splatScale` | `number` | every gaussian's size times this (1 by default): below 1 the scene breaks into points |
| `opacity` | `number` | – |
| `opacity` | `number` | 0..1, multiplying every gaussian's |
| `brightness` | `number` | grade: colour times brightness, saturation and contrast about mid grey, times tint |
| `saturation` | `number` | – |
| `contrast` | `number` | – |
| `tint` | `string` | – |
| `saturation` | `number` | 1 as trained; 0 grey, above 1 richer |
| `contrast` | `number` | 1 as trained; about mid grey |
| `tint` | `string` | a colour every gaussian's is multiplied by |
| `reveal` | `number` | reveal 0..1: each splat scales in as a front passes it, from `revealFrom` (a point; the centre by default) outward, or along `revealAxis` (a plane sweeping through) when that's given |
| `revealFrom` | `Vec3` | – |
| `revealAxis` | `Vec3` | – |
| `revealFrom` | `Vec3` | the point the reveal grows outward from (the centre by default) |
| `revealAxis` | `Vec3` | a direction: the reveal sweeps a plane along it instead of growing from a point |
| `revealSoft` | `number` | how wide the front is, as a share of the sweep (0.15) |
| `revealGlow` | `number` | the front's glow (0 none, 1 bright), in `glowColor` |
| `glowColor` | `string` | the colour of reveal and pulse glows (warm white) |
@@ -505,12 +505,12 @@ The props of [`ShaderExtension`](#shaderextension), tabled there.
| `curl` | `number` | how much the wind curls (1) |
| `spread` | `number` | the dust cloud's radius in metres (the splat's own size, before scale; 1.6 times its size by default) |
| `explode` | `number` | explode 0..1: thrown out from the centre, falling and fading |
| `wave` | `SplatWave` | – |
| `wave` | `SplatWave` | a ripple running out through the splats: amplitude, wavelength and phase |
| `twist` | `number` | radians a metre about the vertical through the centre |
| `morph` | `SplatMorph` | – |
| `morph` | `SplatMorph` | becomes another splat file: `to` and `amount` 0..1 |
| `pulse` | `number` | a value the composition passes (a beat's envelope 0..1): bigger by pulseScale, brighter by pulseGlow |
| `pulseScale` | `number` | – |
| `pulseGlow` | `number` | – |
| `pulseScale` | `number` | how much bigger a full pulse makes it |
| `pulseGlow` | `number` | how much brighter a full pulse makes it |
| `crop` | `number` | nothing past this many metres from the centre (trims a trained scene's floaters) |
| `bands` | `number` | the light in this many flat bands (0 none); a paint or cartoon <Look> sets it |
| `paint` | `number` | 0..1: the splats themselves painted (flat bands, grown into strokes with hard edges), for a painted shot in a timeline whose frame <Look> isn't paint |
@@ -531,27 +531,27 @@ is LinearRgba keys of one colour: track({ 0: E.mul(0), 30: E.mul(2.5) }) with E
| Field | Type | What it is |
| --- | --- | --- |
| `base_color` | `TrackSpec<string>` | – |
| `emissive` | `TrackSpec<string> \| TrackSpec<LinearRgba>` | – |
| `perceptual_roughness` | `TrackSpec<number>` | – |
| `metallic` | `TrackSpec<number>` | – |
| `emissive_exposure_weight` | `TrackSpec<number>` | – |
| `reflectance` | `TrackSpec<number>` | – |
| `specular_tint` | `TrackSpec<string>` | – |
| `diffuse_transmission` | `TrackSpec<number>` | – |
| `specular_transmission` | `TrackSpec<number>` | – |
| `thickness` | `TrackSpec<number>` | – |
| `ior` | `TrackSpec<number>` | – |
| `attenuation_distance` | `TrackSpec<number>` | – |
| `attenuation_color` | `TrackSpec<string>` | – |
| `clearcoat` | `TrackSpec<number>` | – |
| `clearcoat_perceptual_roughness` | `TrackSpec<number>` | – |
| `anisotropy_strength` | `TrackSpec<number>` | – |
| `anisotropy_rotation` | `TrackSpec<number>` | – |
| `depth_bias` | `TrackSpec<number>` | – |
| `parallax_depth_scale` | `TrackSpec<number>` | – |
| `max_parallax_layer_count` | `TrackSpec<number>` | – |
| `lightmap_exposure` | `TrackSpec<number>` | – |
| `base_color` | `TrackSpec<string>` | a track of `base_color`, sampled each frame |
| `emissive` | `TrackSpec<string> \| TrackSpec<LinearRgba>` | a track of `emissive`, sampled each frame |
| `perceptual_roughness` | `TrackSpec<number>` | a track of `perceptual_roughness`, sampled each frame |
| `metallic` | `TrackSpec<number>` | a track of `metallic`, sampled each frame |
| `emissive_exposure_weight` | `TrackSpec<number>` | a track of `emissive_exposure_weight`, sampled each frame |
| `reflectance` | `TrackSpec<number>` | a track of `reflectance`, sampled each frame |
| `specular_tint` | `TrackSpec<string>` | a track of `specular_tint`, sampled each frame |
| `diffuse_transmission` | `TrackSpec<number>` | a track of `diffuse_transmission`, sampled each frame |
| `specular_transmission` | `TrackSpec<number>` | a track of `specular_transmission`, sampled each frame |
| `thickness` | `TrackSpec<number>` | a track of `thickness`, sampled each frame |
| `ior` | `TrackSpec<number>` | a track of `ior`, sampled each frame |
| `attenuation_distance` | `TrackSpec<number>` | a track of `attenuation_distance`, sampled each frame |
| `attenuation_color` | `TrackSpec<string>` | a track of `attenuation_color`, sampled each frame |
| `clearcoat` | `TrackSpec<number>` | a track of `clearcoat`, sampled each frame |
| `clearcoat_perceptual_roughness` | `TrackSpec<number>` | a track of `clearcoat_perceptual_roughness`, sampled each frame |
| `anisotropy_strength` | `TrackSpec<number>` | a track of `anisotropy_strength`, sampled each frame |
| `anisotropy_rotation` | `TrackSpec<number>` | a track of `anisotropy_rotation`, sampled each frame |
| `depth_bias` | `TrackSpec<number>` | a track of `depth_bias`, sampled each frame |
| `parallax_depth_scale` | `TrackSpec<number>` | a track of `parallax_depth_scale`, sampled each frame |
| `max_parallax_layer_count` | `TrackSpec<number>` | a track of `max_parallax_layer_count`, sampled each frame |
| `lightmap_exposure` | `TrackSpec<number>` | a track of `lightmap_exposure`, sampled each frame |
### `StandardMaterialProps`
@@ -562,31 +562,31 @@ Bevy's StandardMaterial fields (colours as CSS colours, textures as file paths),
| `base_color` | `string \| Srgba` | a colour, or Bevy's Srgba (its alpha shows with alpha_mode "Blend": Srgba.hex("#88ccff").with_alpha(0.5)) |
| `base_color_texture` | `Tex \| null` | a picture in the media folder; null (Bevy's None) inside a Model drops the model's own base map |
| `emissive` | `string \| LinearRgba` | a colour, or Bevy's LinearRgba for one brighter than white (LinearRgba.from(Srgba.hex("#ff8800")).mul(3)) |
| `emissive_texture` | `Tex` | – |
| `emissive_texture` | `Tex` | Bevy: The emissive map, multiplies pixels with `emissive` to get the final "emitting" color of a surface. |
| `perceptual_roughness` | `number` | 0.5 by Bevy's default |
| `metallic` | `number` | – |
| `metallic_roughness_texture` | `Tex \| MetallicRoughnessMaps` | – |
| `normal_map_texture` | `Tex` | – |
| `occlusion_texture` | `Tex` | – |
| `metallic` | `number` | Bevy: How "metallic" the material appears, within `[0.0, 1.0]`. |
| `metallic_roughness_texture` | `Tex \| MetallicRoughnessMaps` | Bevy: Metallic and roughness maps, stored as a single texture. |
| `normal_map_texture` | `Tex` | Bevy: Used to fake the lighting of bumps and dents on a material. |
| `occlusion_texture` | `Tex` | Bevy: Specifies the level of exposure to ambient light. |
| `uv_transform` | `Affine2` | every texture's UVs scaled, turned and moved (Affine2.fromScale([5, 5]) tiles a map five times across each face; a scaled texture repeats) |
| `reflectance` | `number` | 0.5 by Bevy's default |
| `clearcoat` | `number` | – |
| `clearcoat_perceptual_roughness` | `number` | – |
| `clearcoat` | `number` | Bevy: An extra thin translucent layer on top of the main PBR layer. This is typically used for painted surfaces. |
| `clearcoat_perceptual_roughness` | `number` | Bevy: The roughness of the clearcoat material. This is specified in exactly the same way as the `StandardMaterial::perceptual_roughness`. |
| `clearcoat_normal_texture` | `Tex` | the clearcoat layer's own normal map, read as data (not sRGB), as Bevy's examples load it with is_srgb false |
| `specular_transmission` | `number` | – |
| `ior` | `number` | – |
| `thickness` | `number` | – |
| `unlit` | `boolean` | – |
| `alpha_mode` | `AlphaMode` | – |
| `double_sided` | `boolean` | – |
| `specular_transmission` | `number` | Bevy: The amount of light transmitted _specularly_ through the material (i.e. via refraction). |
| `ior` | `number` | Bevy: The index of refraction of the material. |
| `thickness` | `number` | Bevy: Thickness of the volume beneath the material surface. |
| `unlit` | `boolean` | Bevy: Whether to apply only the base color to this material. |
| `alpha_mode` | `AlphaMode` | Bevy: How to apply the alpha channel of the `base_color_texture`. |
| `double_sided` | `boolean` | Bevy: Support two-sided lighting by automatically flipping the normals for "back" faces within the PBR lighting shader. |
| `cull_mode` | `"Back" \| "Front" \| null` | the faces not drawn: "Back" (Bevy's default), "Front", or null for neither |
| `material` | `string` | in a <Model>: the glTF material it re-covers, as MeshStandardMaterial's |
| `fog_enabled` | `boolean` | false: left out of the scene's <Fog> |
| `specular_tint` | `string` | the highlight's colour, over `reflectance` |
| `anisotropy_strength` | `number` | stretched highlights (brushed metal, hair), 0..1, turned anisotropy_rotation radians along the tangent |
| `anisotropy_rotation` | `number` | – |
| `anisotropy_rotation` | `number` | Bevy: The direction of increased roughness, in radians relative to the mesh tangent. |
| `attenuation_distance` | `number` | light absorbed through a transmissive volume (with specular_transmission and thickness) |
| `attenuation_color` | `string` | – |
| `attenuation_color` | `string` | Bevy: The resulting (non-absorbed) color after white light travels through the attenuation distance. |
| `depth_map` | `Tex` | a greyscale height map (white deep) the parallax fields carve a flat face with |
| `parallax_depth_scale` | `number` | 0.1 by Bevy's default |
| `parallax_mapping_method` | `"Occlusion" \| { Relief: { max_steps: number } }` | "Occlusion" (Bevy's default) or { Relief: { max_steps } } |
@@ -594,7 +594,7 @@ Bevy's StandardMaterial fields (colours as CSS colours, textures as file paths),
| `depth_bias` | `number` | drawn this much nearer in depth (a decal-like layer over a coplanar face) |
| `opaque_render_method` | `"Forward" \| "Deferred"` | "Forward" or "Deferred" (in the deferred pass, with a camera that has one) |
| `diffuse_transmission` | `number` | light passed through and scattered (leaves, paper, wax), 0..1; lightmap_exposure: a <Lightmap>'s bake times this |
| `lightmap_exposure` | `number` | – |
| `lightmap_exposure` | `number` | Bevy: The exposure (brightness) level of the lightmap, if present. |
| `animate` | `StandardMaterialAnimate` | its fields' tracks, sampled by the engine from the frame clock: { base_color: track({ 0: "#3060ff", 30: "#ff4070" }) } |
### `SurfaceDrawProps`
@@ -619,7 +619,7 @@ from the first frame.
| `textures` | `Record<string, ShaderTexture \| ShaderTexture[]>` | up to 4: an asset path, a picture made in code ({ width, height, pixels }) or "render:NAME"; with a sampler, { src, sampler } (or a picture with its `sampler`). One more may be an array, read as texture_2d_array<f32> by layer: { layers: [picture,...] } (one size and format) or { src, layers: N } (N layers stacked top to bottom). A <Material>'s may also bind one binding_array<texture_2d<f32>>, a list of 1 to 16 pictures (Bevy's texture_binding_array; a GPU without texture binding arrays refuses it) |
| `defs` | `ShaderDefs` | shader defs: each NAME a WESL condition for `@if(NAME)` (a number is true), and a whole number also `constants::NAME`; each set of defs compiles its own pipeline |
| `own` | `OwnMaterialFields` | a <Material>'s own: what its Material methods give, and its storage buffers; set by <Material> only |
| `buffers` | `Record<string, StorageValue>` | – |
| `buffers` | `Record<string, StorageValue>` | the material's storage buffers by binding name; set by <Material> only |
### `ThreeShaderMaterialProps`
@@ -630,12 +630,12 @@ from the first frame.
| `uniforms` | `Record<string, ThreeUniform>` | each uniform's value this frame |
| `textures` | `Record<string, string \| { src: string; colorSpace?: "srgb" \| "linear"; sampler?: Record…` | each sampler's picture: a file, a data URL, "render:NAME" (at most four); `colorSpace: "linear"` for one three samples raw (NoColorSpace: a distance field, a data map), "srgb" (the default) for a colour picture |
| `output` | `"display" \| "linear"` | "display": its colour is what three's canvas shows (a ShaderMaterial's); "linear": scene light, tone-mapped as the rest of the frame is (a node material's) |
| `transparent` | `boolean` | – |
| `blending` | `"normal" \| "additive" \| "add" \| "multiply" \| "none"` | – |
| `side` | `"front" \| "back" \| "double"` | – |
| `depthWrite` | `boolean` | – |
| `depthTest` | `boolean` | – |
| `alphaTest` | `number` | – |
| `transparent` | `boolean` | blended over what's behind it, as three's \`transparent\` |
| `blending` | `"normal" \| "additive" \| "add" \| "multiply" \| "none"` | how it blends: normal, additive (add), multiply or none |
| `side` | `"front" \| "back" \| "double"` | which faces draw: front, back or double |
| `depthWrite` | `boolean` | it writes the depth buffer |
| `depthTest` | `boolean` | it's hidden behind what's nearer |
| `alphaTest` | `number` | pixels less opaque than this are dropped |
| `time` | `[number, number, number]` | three's clock this frame: [seconds, delta, frame] |
| `color` | `string` | the colour it's drawn in where its shader can't run (named in the render's warnings) |
@@ -650,10 +650,10 @@ from the first frame.
| Field | Type | What it is |
| --- | --- | --- |
| `shadow_color` | `TrackSpec<string>` | – |
| `rim_intensity` | `TrackSpec<number>` | – |
| `highlight_intensity` | `TrackSpec<number>` | – |
| `outline_width` | `TrackSpec<number>` | – |
| `shadow_color` | `TrackSpec<string>` | a track of `shadow_color`, sampled each frame |
| `rim_intensity` | `TrackSpec<number>` | a track of `rim_intensity`, sampled each frame |
| `highlight_intensity` | `TrackSpec<number>` | a track of `highlight_intensity`, sampled each frame |
| `outline_width` | `TrackSpec<number>` | a track of `outline_width`, sampled each frame |
### `ToonExtensionProps`
@@ -665,15 +665,15 @@ toon surface has no roughness or metal. It goes in an ExtendedMaterial's `extens
| Field | Type | What it is |
| --- | --- | --- |
| `steps` | `number` | – |
| `bands` | `ToonBand[]` | – |
| `shadow_color` | `string` | – |
| `rim` | `boolean \| ToonRim` | – |
| `highlight` | `boolean \| ToonHighlight` | – |
| `outline` | `boolean \| ToonOutline` | – |
| `rim_intensity` | `number` | – |
| `highlight_intensity` | `number` | – |
| `outline_width` | `number` | – |
| `steps` | `number` | how many hard bands the light falls into (2) |
| `bands` | `ToonBand[]` | an explicit ramp of bands, darkest first, in place of `steps` |
| `shadow_color` | `string` | the bottom band's colour (the base colour darker, nudged towards violet) |
| `rim` | `boolean \| ToonRim` | a rim light on the silhouette: true for its default, or its settings |
| `highlight` | `boolean \| ToonHighlight` | a hard specular highlight: true for its default, or its settings |
| `outline` | `boolean \| ToonOutline` | an ink outline: true for its default, or its settings |
| `rim_intensity` | `number` | how bright the rim is |
| `highlight_intensity` | `number` | how bright the highlight is |
| `outline_width` | `number` | the outline's width |
| `animate` | `ToonExtensionAnimate` | its fields' tracks, as a StandardMaterial's `animate` (its base animates base_color and emissive) |
### `ToonHighlight`
@@ -714,15 +714,15 @@ The props of [`ToonMaterial`](#toonmaterial), tabled there.
| `colors` | `[string, string, string]` | its tones under a paint look: [lit, mid, dark] |
| `threshold` | `number` | the density its painted surface sits at (0.12): lower is fatter, higher thinner |
| `erode` | `number` | how much noise tears the painted surface's edge (0.08), and the tears' size in metres (0.6) |
| `erodeSize` | `number` | – |
| `erodeSize` | `number` | the tears' size in metres (0.6) |
| `absorb` | `number` | how much light a unit of it stops (its shadow on itself; 1.2) |
| `wind` | `Vec3` | the wind, m/s ([0, 0, 0]); how fast the volume takes it up, a second (1.2 smoke, 0.6 otherwise); the height it's full from, metres, weaker below (0: full everywhere) |
| `windPull` | `number` | – |
| `windHeight` | `number` | – |
| `windPull` | `number` | how fast the volume takes up the wind, a second (1.2 smoke, 0.6 otherwise) |
| `windHeight` | `number` | the height the wind is full from, metres; weaker below (0: full everywhere) |
| `drag` | `number` | velocity the still air takes away a second (0.4) |
| `vorticity` | `number` | curl kept curling (6); a drifting turbulent force, m/s² (0), and its size in metres (2) |
| `turbulence` | `number` | – |
| `turbulenceSize` | `number` | – |
| `turbulence` | `number` | a drifting turbulent force, m/s² (0) |
| `turbulenceSize` | `number` | the turbulence's size in metres (2) |
| `steps` | `number` | samples along each ray (96) |
| `shadow` | `boolean \| number` | its shadow, cast in the scene's light as a mesh's is (on by default): soft moving shadows on the ground, meshes and models under it, and, with a `volumetric` sun and a <FogVolume> under <VolumetricFog>, the sun's shafts breaking through the gaps between clouds. The shadow is where the volume has stopped half the sun; a number scales the density it sees: 1 as drawn, more reaches into its thinner parts (a fatter shadow; up to 4, a thin contrail's made to show), less keeps to the dense cores. false or 0 casts none. Under a paint look the shadow is the painted shape. Soften its edge with the sun's `softShadow` (2-4 for clouds) |
@@ -733,13 +733,13 @@ The props of [`ToonMaterial`](#toonmaterial), tabled there.
| `position` | `Vec3` | the box's foot (the centre of its floor), metres ([0, 0, 0]) |
| `size` (required) | `Vec3` | the box it lives in, [width, height, depth] in metres: what leaves it is cut |
| `sources` | `VolumeSource[]` | where density and heat come in over time, and the puffs of density it starts with ([x, y, z, radius] in metres from the foot) |
| `puffs` | `[number, number, number, number][]` | – |
| `puffs` | `[number, number, number, number][]` | density it starts with: [x, y, z, radius] in metres from the foot |
| `buoyancy` | `number` | heat's lift (4) and the density's weight (0.4), m/s² a unit; the heat lost a second (0.8) and the density lost a second (0.02), fractions |
| `weight` | `number` | – |
| `cooling` | `number` | – |
| `dissipation` | `number` | – |
| `weight` | `number` | the density's weight, m/s² a unit (0.4) |
| `cooling` | `number` | the heat lost a second, a fraction (0.8) |
| `dissipation` | `number` | the density lost a second, a fraction (0.02) |
| `fire` | `[string, string, string] \| false` | fire where it's hot: three colours [red, orange, yellow] (paint's by default), or false for none; and the heat (a fraction of the hottest source's) each colour starts at ([0.35, 0.6, 0.85]) |
| `fireAt` | `[number, number, number]` | – |
| `fireAt` | `[number, number, number]` | the heat (a fraction of the hottest source's) each fire colour starts at ([0.35, 0.6, 0.85]) |
| `name` | `string` | parts are matched by name across frames |
| `time` | `number` | seconds on the simulation's clock (the Sequence's time, frame / fps, by default) |
| `resolution` | `number` | cells along the box's longest side (64 by default; 32 is a quarter the cost a step, 96 finer) |
@@ -747,15 +747,15 @@ The props of [`ToonMaterial`](#toonmaterial), tabled there.
| `colors` | `[string, string, string]` | its tones under a paint look: [lit, mid, dark] |
| `threshold` | `number` | the density its painted surface sits at (0.12): lower is fatter, higher thinner |
| `erode` | `number` | how much noise tears the painted surface's edge (0.08), and the tears' size in metres (0.6) |
| `erodeSize` | `number` | – |
| `erodeSize` | `number` | the tears' size in metres (0.6) |
| `absorb` | `number` | how much light a unit of it stops (its shadow on itself; 1.2) |
| `wind` | `Vec3` | the wind, m/s ([0, 0, 0]); how fast the volume takes it up, a second (1.2 smoke, 0.6 otherwise); the height it's full from, metres, weaker below (0: full everywhere) |
| `windPull` | `number` | – |
| `windHeight` | `number` | – |
| `windPull` | `number` | how fast the volume takes up the wind, a second (1.2 smoke, 0.6 otherwise) |
| `windHeight` | `number` | the height the wind is full from, metres; weaker below (0: full everywhere) |
| `drag` | `number` | velocity the still air takes away a second (0.4) |
| `vorticity` | `number` | curl kept curling (6); a drifting turbulent force, m/s² (0), and its size in metres (2) |
| `turbulence` | `number` | – |
| `turbulenceSize` | `number` | – |
| `turbulence` | `number` | a drifting turbulent force, m/s² (0) |
| `turbulenceSize` | `number` | the turbulence's size in metres (2) |
| `steps` | `number` | samples along each ray (96) |
| `shadow` | `boolean \| number` | its shadow, cast in the scene's light as a mesh's is (on by default): soft moving shadows on the ground, meshes and models under it, and, with a `volumetric` sun and a <FogVolume> under <VolumetricFog>, the sun's shafts breaking through the gaps between clouds. The shadow is where the volume has stopped half the sun; a number scales the density it sees: 1 as drawn, more reaches into its thinner parts (a fatter shadow; up to 4, a thin contrail's made to show), less keeps to the dense cores. false or 0 casts none. Under a paint look the shadow is the painted shape. Soften its edge with the sun's `softShadow` (2-4 for clouds) |
@@ -766,13 +766,13 @@ where density and heat come in: a burner, or an engine moving `at` -> `to` (a co
| Field | Type | What it is |
| --- | --- | --- |
| `at` (required) | `Vec3` | where (metres from the box's foot), and where it has moved to by `until` if it moves |
| `to` | `Vec3` | – |
| `to` | `Vec3` | where a moving source has got to by `until` |
| `from` | `number` | when it puts out, seconds ([0, Infinity]) |
| `until` | `number` | – |
| `until` | `number` | when it stops putting out, seconds (Infinity) |
| `radius` | `number` | its radius (0.5 m); the density and heat it puts out a second at its centre (4 and 4); the velocity it pushes out with, m/s ([0, 0, 0]) |
| `rate` | `number` | – |
| `heat` | `number` | – |
| `speed` | `Vec3` | – |
| `rate` | `number` | the density it puts out a second at its centre (4) |
| `heat` | `number` | the heat it puts out a second at its centre (4) |
| `speed` | `Vec3` | the velocity it pushes out with, m/s ([0, 0, 0]) |
### `VolumetricFogProps`
+4 -4
View File
@@ -43,7 +43,7 @@ function pointerRay(pointer: { x: number; y: number; }, camera: PickCamera, size
| Field | Type | What it is |
| --- | --- | --- |
| `name` (required) | `string` | – |
| `name` (required) | `string` | the pickable it hit |
| `distance` (required) | `number` | metres from the camera (from its near plane's point, for an orthographic one) along the ray |
| `point` (required) | `Vec3` | where the ray first meets it, in world space |
@@ -61,10 +61,10 @@ The camera as a scene sets it: a PerspectiveCamera's props (fov in degrees, vert
| Field | Type | What it is |
| --- | --- | --- |
| `position` | `Vec3` | – |
| `lookAt` | `Vec3` | – |
| `position` | `Vec3` | where it stands, metres (x, y, z) |
| `lookAt` | `Vec3` | the point it faces |
| `fov` | `number` | vertical field of view in degrees (50 by default); ignored when `height` is set |
| `height` | `number` | an orthographic camera's view height in metres |
| `up` | `Vec3` | – |
| `up` | `Vec3` | which way is up for it (+Y) |
<!-- generated:end -->
+9 -11
View File
@@ -53,7 +53,7 @@ Takes [`BloomProps`](3d.md#bloomprops)'s props.
A compute over the frame, in the 3D beside the camera; several run in the order written, before the cameras draw.
Bevy: `raea_sys_compute::Computes`.
Rust: `raea_sys_compute::Computes`.
Takes [`ComputeProps`](3d.md#computeprops)'s props.
@@ -79,7 +79,7 @@ Takes [`FisheyeProps`](3d.md#fisheyeprops)'s props.
A full-screen pass over the scene camera's frame, beside the camera; several run in the order written. With a
frame <Look> they run on its cells, before the look's composite.
Bevy: `raea_sys_framepass::FramePasses`.
Rust: `raea_sys_framepass::FramePasses`.
Takes [`FramePassProps`](3d.md#framepassprops)'s props.
@@ -126,8 +126,6 @@ Takes [`MotionBlurProps`](3d.md#motionblurprops)'s props.
Ink lines where the scene's depth steps or its surfaces turn, drawn before bloom and tone mapping; under a <Look>
a cell wide (Return of the Obra Dinn's line). Put it inside the Canvas3D.
Bevy: `bevy_ui::Outline`.
Takes [`OutlineProps`](3d.md#outlineprops)'s props.
### `ToneMapping`
@@ -182,8 +180,8 @@ A compute shader (raea-sys-compute). Its source has one `@compute` entry point a
| `mode` | `"bokeh" \| "gaussian"` | "bokeh" (round, as a real lens; the default) or "gaussian" (soft, cheaper) |
| `maxBlur` | `number` | the largest blur, in pixels of the frame (64 by default) |
| `focal_distance` | `number` | Bevy's fields, as Bevy's DepthOfField component on a Camera3d (inside it), Bevy's defaults: the distance in focus (10; the camera's `focus`), the f-number (1), the largest blur in pixels (64), "Bokeh" or "Gaussian" |
| `aperture_f_stops` | `number` | – |
| `max_circle_of_confusion_diameter` | `number` | – |
| `aperture_f_stops` | `number` | the f-number (1): lower is a shallower focus |
| `max_circle_of_confusion_diameter` | `number` | the largest blur, in px (64) |
### `FisheyeProps`
@@ -223,9 +221,9 @@ A shader over the whole frame. Its source defines
| `temperature` | `number` | warmer (+) or cooler (-): a shift of the CIE x chromaticity, about -0.3 to 0.3 |
| `tint` | `number` | magenta (+) or green (-) |
| `saturation` | `number` | the whole frame's saturation after tone mapping (1 keeps it) |
| `shadows` | `GradeSection` | – |
| `midtones` | `GradeSection` | – |
| `highlights` | `GradeSection` | – |
| `shadows` | `GradeSection` | the grade on the shadows: saturation, contrast, gamma, gain, lift |
| `midtones` | `GradeSection` | the grade on the midtones |
| `highlights` | `GradeSection` | the grade on the highlights |
| `vignette` | `number \| { intensity?: number; radius?: number; smoothness?: number; color?: string }` | the corners darkened: 0 none, 1 black; or {intensity, radius (0.75), smoothness (5), color} |
| `aberration` | `number` | a lens's colour fringes at edges, as a fraction of the frame (0.005 subtle, 0.02 strong) |
| `skip` | `string[]` | composition passes (a part's `pass`) the grade leaves as drawn: no fringes or vignette on them, and on an untonemapped camera (a paint Look's) no colour grading either |
@@ -253,7 +251,7 @@ A shader over the whole frame. Its source defines
| Field | Type | What it is |
| --- | --- | --- |
| `k1` | `number` | Brown-Conrady: r' = r (1 + k1 r^2 + k2 r^4), r a share of the half-diagonal. Above 0 barrel, below 0 pincushion |
| `k2` | `number` | – |
| `k2` | `number` | the r^4 term of the distortion |
| `zoom` | `number` | by default just enough for a barrel's corners to stay inside the picture (1 for pincushion) |
| `edges` | `"clamp" \| "black"` | what shows where the lens looks past the picture: its edge pixels ("clamp", the default) or "black" |
| `animate` | `Animate3d` | declared animation of its numbers (strength, fov, k1, k2, zoom) |
@@ -266,7 +264,7 @@ A shader over the whole frame. Its source defines
| --- | --- | --- |
| `shutterAngle` | `number` | the fraction of a frame the shutter is open (0.5 by default, a 180-degree shutter); above 1 smears further |
| `samples` | `number` | samples each way per pixel (4 by default) |
| `animate` | `Animate3d` | – |
| `animate` | `Animate3d` | declared animation of its numbers |
### `OutlineProps`
+283 -290
View File
@@ -48,11 +48,11 @@ A box over the whole of its parent, laid out as a flex column; `style` is merged
| Prop | Type | What it does |
| --- | --- | --- |
| `style` | `CSSProperties` | – |
| `className` | `string` | – |
| `children` | `ReactNode` | – |
| `style` | `CSSProperties` | merged over the fill's own style (absolute, inset 0, a flex column) |
| `className` | `string` | Tailwind or CSS classes |
| `children` | `ReactNode` | what fills it |
Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx), [ui/images/ui_texture_slice_flip_and_tile](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice_flip_and_tile.tsx), [ui/images/image_node_resizing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node_resizing.tsx), [ui/images/ui_texture_atlas_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas_slice.tsx), [ui/images/ui_texture_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice.tsx), [ui/images/ui_texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx), [ui/layout/grid](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/grid.tsx), [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), and 98 more.
Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx), [ui/images/ui_texture_slice_flip_and_tile](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice_flip_and_tile.tsx), [ui/images/image_node_resizing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node_resizing.tsx), [ui/images/ui_texture_atlas_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas_slice.tsx), [ui/images/ui_texture_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice.tsx), [ui/images/ui_texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx), [ui/layout/grid](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/grid.tsx), [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), and 95 more.
### `Animate`
@@ -81,17 +81,17 @@ own.
| Prop | Type | What it does |
| --- | --- | --- |
| `frame` (required) | `number` | – |
| `fps` (required) | `number` | – |
| `width` (required) | `number` | – |
| `height` (required) | `number` | – |
| `durationInFrames` (required) | `number` | – |
| `id` | `string` | – |
| `defaultProps` | `Record<string, unknown>` | – |
| `words` | `readonly TimelineWord[]` | – |
| `perception` | `Perception` | – |
| `input` | `InputTimeline` | – |
| `children` | `ReactNode` | – |
| `frame` (required) | `number` | the composition frame to draw |
| `fps` (required) | `number` | frames a second |
| `width` (required) | `number` | in px |
| `height` (required) | `number` | in px |
| `durationInFrames` (required) | `number` | the composition's length in frames |
| `id` | `string` | the composition's id ("main" by default) |
| `defaultProps` | `Record<string, unknown>` | the props the composition is rendered with |
| `words` | `readonly TimelineWord[]` | the transcript, in composition frames, that captions and word cuts read |
| `perception` | `Perception` | what perception saw at this frame (faces, the safe area) |
| `input` | `InputTimeline` | a game's recorded input by frame |
| `children` | `ReactNode` | the composition |
### `Composition`
@@ -99,16 +99,16 @@ Declares a composition inside the root. It draws nothing itself; a renderer find
| Prop | Type | What it does |
| --- | --- | --- |
| `id` (required) | `string` | – |
| `component` (required) | `ComponentType<P>` | – |
| `width` (required) | `number` | – |
| `height` (required) | `number` | – |
| `fps` (required) | `number` | – |
| `durationInFrames` (required) | `number` | – |
| `defaultProps` | `P` | – |
| `id` (required) | `string` | the composition's id: letters, digits and dashes (`raea render --composition` picks it) |
| `component` (required) | `ComponentType<P>` | the React component it renders |
| `width` (required) | `number` | in px |
| `height` (required) | `number` | in px |
| `fps` (required) | `number` | frames a second |
| `durationInFrames` (required) | `number` | its length in frames |
| `defaultProps` | `P` | the props it's rendered with (JSON-like values only) |
| `edit` | `Edit` | a hand edit laid over the composition (docs/craft-system.md, L): written back by the app's timeline |
Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx), [ui/images/ui_texture_slice_flip_and_tile](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice_flip_and_tile.tsx), [ui/images/image_node_resizing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node_resizing.tsx), [ui/images/ui_texture_atlas_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas_slice.tsx), [ui/images/ui_texture_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice.tsx), [ui/images/ui_texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx), [ui/layout/grid](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/grid.tsx), [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), and 152 more.
Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx), [ui/images/ui_texture_slice_flip_and_tile](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice_flip_and_tile.tsx), [ui/images/image_node_resizing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node_resizing.tsx), [ui/images/ui_texture_atlas_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas_slice.tsx), [ui/images/ui_texture_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice.tsx), [ui/images/ui_texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx), [ui/layout/grid](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/grid.tsx), [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), and 148 more.
### `Freeze`
@@ -116,8 +116,8 @@ Shows its children as they are at `frame`, whatever the parent's frame.
| Prop | Type | What it does |
| --- | --- | --- |
| `frame` (required) | `number` | – |
| `children` | `ReactNode` | – |
| `frame` (required) | `number` | the frame its children see, whatever the parent's frame |
| `children` | `ReactNode` | what's held |
### `Img`
@@ -133,12 +133,12 @@ and while another box holds a press, they see no pointer; keys reach every box.
| Prop | Type | What it does |
| --- | --- | --- |
| `x` (required) | `number` | – |
| `y` (required) | `number` | – |
| `w` (required) | `number` | – |
| `h` (required) | `number` | – |
| `scale` | `number` | – |
| `children` | `ReactNode` | – |
| `x` (required) | `number` | the box's left edge, composition px |
| `y` (required) | `number` | its top edge, composition px |
| `w` (required) | `number` | its width, px |
| `h` (required) | `number` | its height, px |
| `scale` | `number` | page px over the box's own points (1): the pointer is divided by it |
| `children` | `ReactNode` | the game or panel that sees the pointer as its own |
### `Loop`
@@ -146,13 +146,13 @@ Repeats its children every `durationInFrames` frames, `times` times (forever by
| Prop | Type | What it does |
| --- | --- | --- |
| `durationInFrames` (required) | `number` | – |
| `times` | `number` | – |
| `name` | `string` | – |
| `layout` | `SequenceLayout` | – |
| `style` | `CSSProperties` | – |
| `className` | `string` | – |
| `children` | `ReactNode` | – |
| `durationInFrames` (required) | `number` | the length of one loop, in frames |
| `times` | `number` | how many times it plays (forever by default) |
| `name` | `string` | its label in the timeline and the render manifest |
| `layout` | `SequenceLayout` | "absolute-fill" (default) or "none", as a Sequence's |
| `style` | `CSSProperties` | the wrapping box's style |
| `className` | `string` | the wrapping box's classes |
| `children` | `ReactNode` | what loops |
### `Mix`
@@ -167,17 +167,14 @@ The master: every sound in the composition brought to `lufs` integrated loudness
### `Nudge`
Places its child: an element gets the move in front of its own transform and the fade times its own opacity; a
component, whose box it can't reach, is placed inside a full-frame layer.
Moves its child by (x, y): an element gets the move in front of its own transform; a component, whose box it
can't reach, moves inside a full-frame layer.
| Prop | Type | What it does |
| --- | --- | --- |
| `x` | `number` | how far to move it, in the composition's pixels |
| `y` | `number` | – |
| `scale` | `number` | how much bigger (2) or smaller (0.5), about its centre |
| `rotate` | `number` | a turn, in degrees, about its centre |
| `opacity` | `number` | 0 (gone) to 1 (as it was), times its own opacity |
| `children` | `ReactNode` | – |
| `y` | `number` | how far to move it down, in the composition's pixels |
| `children` | `ReactNode` | the part it places: an element, or a component, which moves inside a full-frame layer |
### `Overlay`
@@ -185,8 +182,8 @@ Its children only in a render asked for the overlay `name`.
| Prop | Type | What it does |
| --- | --- | --- |
| `name` (required) | `string` | – |
| `children` | `ReactNode` | – |
| `name` (required) | `string` | the overlay's name, as the render asks for it |
| `children` | `ReactNode` | what the overlay draws |
### `Region`
@@ -194,11 +191,11 @@ A box at the band its name stands for, clear of the face perception found at thi
| Prop | Type | What it does |
| --- | --- | --- |
| `name` | `RegionName` | – |
| `margin` | `number` | – |
| `style` | `CSSProperties` | – |
| `className` | `string` | – |
| `children` | `ReactNode` | – |
| `name` | `RegionName` | the band: "auto" (default) takes the larger of top and bottom; top and bottom stay clear of the face; center is the middle third; full is the safe area |
| `margin` | `number` | the gap kept from the face and the sides, as a share of the width (0.06) |
| `style` | `CSSProperties` | merged under the box's own placement |
| `className` | `string` | Tailwind or CSS classes |
| `children` | `ReactNode` | what goes in the band; `useRegion()` reads its box |
### `Sequence`
@@ -206,17 +203,15 @@ Shifts time by `from` and shows its children only for `durationInFrames` frames.
| Prop | Type | What it does |
| --- | --- | --- |
| `from` | `number` | – |
| `durationInFrames` | `number` | – |
| `name` | `string` | – |
| `layout` | `SequenceLayout` | – |
| `width` | `number` | – |
| `height` | `number` | – |
| `style` | `CSSProperties` | – |
| `className` | `string` | – |
| `children` | `ReactNode` | – |
Used in: [manual: hello](https://github.com/shinyobjectz/raea/blob/main/docs/manual/examples/hello.tsx).
| `from` | `number` | the parent frame its frame 0 falls on (0) |
| `durationInFrames` | `number` | how many frames it shows its children (forever by default) |
| `name` | `string` | its label in the timeline and the render manifest (`data-sequence`) |
| `layout` | `SequenceLayout` | "absolute-fill" (default) wraps the children in a full-size box; "none" adds no box |
| `width` | `number` | the width its children see, px (the parent's by default) |
| `height` | `number` | the height its children see, px (the parent's by default) |
| `style` | `CSSProperties` | the wrapping box's style |
| `className` | `string` | the wrapping box's classes |
| `children` | `ReactNode` | what plays in it, at its own local time |
### `Series`
@@ -224,7 +219,7 @@ Plays its Series.Sequence children back to back, each shifted by its own offset.
| Prop | Type | What it does |
| --- | --- | --- |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | the Series.Sequence slots, played back to back |
### `SongPlot`
@@ -233,10 +228,10 @@ it, hits, the feature lanes, and the pacing (cuts per bar). `raea song FILE --pl
| Prop | Type | What it does |
| --- | --- | --- |
| `map` (required) | `SongMap` | – |
| `width` | `number` | – |
| `height` | `number` | – |
| `title` | `string` | – |
| `map` (required) | `SongMap` | the song's map, from \`raea song\` |
| `width` | `number` | in px |
| `height` | `number` | in px |
| `title` | `string` | the heading (the song's name, tempo, metre and length by default) |
### `Stagger`
@@ -266,7 +261,7 @@ The frame being rendered, counted from the start of the nearest enclosing Sequen
function useCurrentFrame(): number
```
Used in: [ui/scroll_and_overflow/overflow_transform](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow_transform.tsx), [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/ui_material](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/ui_material.tsx), [ui/styling/gradients](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/styling/gradients.tsx), [ui/text/text_debug](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/text_debug.tsx), [ui/text/text](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/text.tsx), [ui/text/font_atlas_debug](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/font_atlas_debug.tsx), [3d/fog_volumes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog_volumes.tsx), and 46 more.
Used in: [ui/scroll_and_overflow/overflow_transform](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow_transform.tsx), [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/ui_material](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/ui_material.tsx), [ui/styling/gradients](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/styling/gradients.tsx), [ui/text/text_debug](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/text_debug.tsx), [ui/text/text](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/text.tsx), [ui/text/font_atlas_debug](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/font_atlas_debug.tsx), [3d/fog_volumes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog_volumes.tsx), and 43 more.
### `useGameEvents`
@@ -289,7 +284,7 @@ in order. Frames count from the nearest enclosing Sequence, so a game starts whe
function useGameState<S>(initial: S, step: Step<S>): S
```
Used in: [shader/shader_prepass](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/shader/shader_prepass.tsx), [shader/sprite_material](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/shader/sprite_material.tsx), [manual: squash](https://github.com/shinyobjectz/raea/blob/main/docs/manual/examples/squash.tsx).
Used in: [shader/shader_prepass](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/shader/shader_prepass.tsx), [shader/sprite_material](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/shader/sprite_material.tsx).
### `useInput`
@@ -329,8 +324,6 @@ The settings of the composition being rendered (a Sequence's width and height wi
function useVideoConfig(): VideoConfig
```
Used in: [manual: title](https://github.com/shinyobjectz/raea/blob/main/docs/manual/examples/title.tsx), [manual: turntable](https://github.com/shinyobjectz/raea/blob/main/docs/manual/examples/turntable.tsx).
### `useWords`
Every word heard on the timeline, in the frames of the nearest enclosing Sequence.
@@ -449,8 +442,6 @@ range (`extend`, the default, carries on; `clamp` holds the end value; `identity
function interpolate(x: number, input: readonly number[], output: readonly number[], options?: InterpolateOptions): number
```
Used in: [manual: turntable](https://github.com/shinyobjectz/raea/blob/main/docs/manual/examples/turntable.tsx), [manual: hello](https://github.com/shinyobjectz/raea/blob/main/docs/manual/examples/hello.tsx).
### `isGeneratedAsset`
Whether a value is a generated asset (what sao, tokensynthNote and lyria return), not a file path.
@@ -570,7 +561,7 @@ Names the root component the renderer starts from, and records its compositions.
function registerRoot(given: ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentType): void
```
Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx), [ui/images/ui_texture_slice_flip_and_tile](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice_flip_and_tile.tsx), [ui/images/image_node_resizing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node_resizing.tsx), [ui/images/ui_texture_atlas_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas_slice.tsx), [ui/images/ui_texture_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice.tsx), [ui/images/ui_texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx), [ui/layout/grid](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/grid.tsx), [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), and 152 more.
Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx), [ui/images/ui_texture_slice_flip_and_tile](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice_flip_and_tile.tsx), [ui/images/image_node_resizing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node_resizing.tsx), [ui/images/ui_texture_atlas_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas_slice.tsx), [ui/images/ui_texture_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice.tsx), [ui/images/ui_texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx), [ui/layout/grid](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/grid.tsx), [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), and 148 more.
### `replayDecider`
@@ -673,8 +664,6 @@ stretches it to end at that frame. `measureSpring` says how long one takes to se
function spring(opts: SpringOptions): number
```
Used in: [manual: title](https://github.com/shinyobjectz/raea/blob/main/docs/manual/examples/title.tsx).
### `stagger`
The parts `each` frames apart, each with `m`. With `grid`, delays spread by grid distance from an origin.
@@ -803,8 +792,6 @@ The easing curves, each a function of progress 0..1: `linear`, `quad`, `cubic`,
`back`, `elastic`, `bounce` and `bezier(x1, y1, x2, y2)`, eased in as they are; `Easing.out(f)` and `Easing.inOut(f)`
turn one round. Pass one as `interpolate`'s `easing`.
Used in: [manual: turntable](https://github.com/shinyobjectz/raea/blob/main/docs/manual/examples/turntable.tsx).
### `FEED_KEY`
The prefix of the keys the app hands every panel for what it knows: `feed:transcript` (the conversation's last lines,
@@ -857,11 +844,11 @@ type Actions = Action<C, E> | readonly Action<C, E>[]
| Field | Type | What it is |
| --- | --- | --- |
| `id` (required) | `string` | – |
| `states` (required) | `{ name: N; parent: N \| null; depth: number; kind: "leaf" \| "compound" \| "final"; initia…` | – |
| `edges` (required) | `Edge<N>[]` | – |
| `id` (required) | `string` | the machine's id |
| `states` (required) | `{ name: N; parent: N \| null; depth: number; kind: "leaf" \| "compound" \| "final"; initia…` | every state with its parent, depth, kind and whether it's an initial state |
| `edges` (required) | `Edge<N>[]` | every transition |
| `reachable` (required) | `N[]` | states some sequence of transitions reaches from the initial state (guards assumed satisfiable) |
| `unreachable` (required) | `N[]` | – |
| `unreachable` (required) | `N[]` | states no sequence of transitions reaches |
| `deadEnds` (required) | `N[]` | non-final leaves with no transition out (their own or an enclosing state's): once entered, never left |
### `AnimateOwnProps`
@@ -874,12 +861,12 @@ type Actions = Action<C, E> | readonly Action<C, E>[]
| `at` | `number` | local frame the entrance starts (0) |
| `exitAt` | `number` | local frame the exit starts |
| `timeline` | `Plan` | a timeline's plan and this element's part in it: the part's move, at its start (plus `at`) |
| `part` | `string` | – |
| `part` | `string` | the part in \`timeline\` whose move this element plays |
| `mount` | `"during" \| "always"` | "always" (default): in the tree, and its layout, the whole time (invisible before an entrance that fades in); "during": only from the entrance's start until the exit ends (it takes its space when it arrives) |
| `as` | `string` | the element: "div" by default |
| `style` | `CSSProperties` | – |
| `className` | `string` | – |
| `children` | `ReactNode` | – |
| `style` | `CSSProperties` | inline style |
| `className` | `string` | Tailwind or CSS classes |
| `children` | `ReactNode` | what moves |
### `AnimateProps`
@@ -889,42 +876,48 @@ type AnimateProps = AnimateOwnProps & { [attr: string]: unknown }
### `Animation`
raea_core_animate::spec::Animation
One element's declared animation.
Rust: `raea_core_animate::spec::Animation`.
| Field | Type | What it is |
| --- | --- | --- |
| `origin` (required) | `number` | – |
| `freeze` (required) | `number \| null` | – |
| `fps` (required) | `number` | – |
| `tracks` (required) | `(AnimTrack)[]` | – |
| `show_from` (required) | `number \| null` | – |
| `show_until` (required) | `number \| null` | – |
| `origin` (required) | `number` | the composition frame the element's local frame 0 falls on (where its Sequence starts) |
| `freeze` (required) | `number \| null` | a local frame to hold at whatever the composition's frame (inside a Freeze) |
| `fps` (required) | `number` | the frames per second its frames count; springs measure their settle time with it (0: the clock's) |
| `tracks` (required) | `(AnimTrack)[]` | the element's keyframed properties, one track each |
| `show_from` (required) | `number \| null` | the local frame it's shown from, when it shows only for a window (mount="during"); before it, display none |
| `show_until` (required) | `number \| null` | the local frame it's hidden from again |
### `AnimKey`
raea_core_animate::spec::AnimKey
One key: a value at a local frame, and the curve from it to the next key.
Rust: `raea_core_animate::spec::AnimKey`.
| Field | Type | What it is |
| --- | --- | --- |
| `at` (required) | `number` | – |
| `value` (required) | `number` | – |
| `color` (required) | `string` | – |
| `ease` (required) | `string` | – |
| `at` (required) | `number` | the local frame it's at |
| `value` (required) | `number` | a number property's value there |
| `color` (required) | `string` | a colour property's value (CSS text); empty for numbers |
| `ease` (required) | `string` | the curve to the next key (easing::Easing::parse); empty is linear |
### `AnimTrack`
raea_core_animate::spec::AnimTrack
Keyframes on one property.
Rust: `raea_core_animate::spec::AnimTrack`.
| Field | Type | What it is |
| --- | --- | --- |
| `prop` (required) | `string` | – |
| `keys` (required) | `(AnimKey)[]` | – |
| `unit` (required) | `string` | – |
| `repeat` (required) | `string` | – |
| `digits` (required) | `number` | – |
| `prefix` (required) | `string` | – |
| `suffix` (required) | `string` | – |
| `separator` (required) | `string` | – |
| `prop` (required) | `string` | the property it keys: opacity, x, y, z, scale, rotate, width, height, blur, clip, a colour, `text`, or another number |
| `keys` (required) | `(AnimKey)[]` | its keyframes in frame order |
| `unit` (required) | `string` | a length's unit: "px" (when empty) or "%" |
| `repeat` (required) | `string` | past the last key: "" or "hold", "loop", "pingpong" (for ever), or "loop:N" / "pingpong:N" |
| `digits` (required) | `number` | decimals a `text` number is written with |
| `prefix` (required) | `string` | written before and after a `text` number (a counter's "$" and " pts") |
| `suffix` (required) | `string` | written after a `text` number |
| `separator` (required) | `string` | between a `text` number's thousands ("," writes 12,345); empty: none |
### `AnyMachine`
@@ -948,13 +941,13 @@ A choice point as a decider sees it: which machine, where, and the candidates wh
| Field | Type | What it is |
| --- | --- | --- |
| `machine` (required) | `string` | – |
| `machine` (required) | `string` | the machine's id |
| `state` (required) | `string` | the state whose `choose` list this is, and the active leaf |
| `leaf` (required) | `string` | – |
| `leaf` (required) | `string` | the active leaf state |
| `n` (required) | `number` | the machine's step |
| `candidates` (required) | `{ edge: number; to: string; description?: string }[]` | the candidates whose guards hold, in their order (each an edge of machine.edges) |
| `ctx` (required) | `C` | – |
| `env` (required) | `E` | – |
| `ctx` (required) | `C` | the context the machine drives |
| `env` (required) | `E` | whatever the step was given as env |
### `ClockProps`
@@ -999,8 +992,8 @@ is asked outside the step and their answer replayed (`replayDecider`). Determini
| Field | Type | What it is |
| --- | --- | --- |
| `name` (required) | `string` | – |
| `decide` (required) | `(point: ChoicePoint<unknown, unknown>) => Decision` | – |
| `name` (required) | `string` | its name in the trace's `by` column |
| `decide` (required) | `(point: ChoicePoint<unknown, unknown>) => Decision` | picks a candidate at a choice point, synchronously |
### `Decision`
@@ -1009,8 +1002,8 @@ whatever supports the choice (a bot's score, a model's probabilities), recorded
| Field | Type | What it is |
| --- | --- | --- |
| `edge` (required) | `number \| null` | – |
| `evidence` | `unknown` | – |
| `edge` (required) | `number \| null` | the edge picked, one of the candidates' `edge`; null waits this step |
| `evidence` | `unknown` | what supports the choice (a bot's score, a model's probabilities), recorded with the transition |
### `EasingFn`
@@ -1022,14 +1015,14 @@ type EasingFn = (p: number) => number
| Field | Type | What it is |
| --- | --- | --- |
| `index` (required) | `number` | – |
| `from` (required) | `N` | – |
| `to` (required) | `N` | – |
| `kind` (required) | `"always" \| "after" \| "on" \| "done" \| "choose"` | – |
| `index` (required) | `number` | its place in `machine.edges` |
| `from` (required) | `N` | the state it leaves |
| `to` (required) | `N` | the state it enters |
| `kind` (required) | `"always" \| "after" \| "on" \| "done" \| "choose"` | what fires it: a guard polled each step (always), a delay (after), an event (on), the substate finishing (done) or a decider (choose) |
| `event` | `string` | the event an `on` edge waits for |
| `after` (required) | `number` | steps in `from` before it may fire |
| `guarded` (required) | `boolean` | – |
| `description` | `string` | – |
| `guarded` (required) | `boolean` | whether it has a guard (`when`) |
| `description` | `string` | what the transition means, from its config |
### `Edit`
@@ -1038,7 +1031,7 @@ a split, a cut word or a moved span is a change to this list; the length becomes
| Field | Type | What it is |
| --- | --- | --- |
| `segments` | `readonly (readonly [number, number])[]` | – |
| `segments` | `readonly (readonly [number, number])[]` | the composition's own frame ranges, [from, to), played one after another |
### `ExtrapolateMode`
@@ -1074,9 +1067,9 @@ The props of [`Freeze`](#freeze), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `kind` (required) | `AssetKind` | – |
| `prompt` (required) | `string` | – |
| `seconds` (required) | `number` | – |
| `kind` (required) | `AssetKind` | which generator makes it: lyria (music), sao (sound effects) or tokensynth (an instrument's note) |
| `prompt` (required) | `string` | what to make, in words |
| `seconds` (required) | `number` | how long it is |
| `id` (required) | `string` | a stable hash of kind, prompt and seconds |
| `src` (required) | `string` | "asset:<kind>/<id>" |
| `options` | `Record<string, unknown>` | the generator's own settings (a TokenSynth note's midi, velocity, seed and device) |
@@ -1091,8 +1084,8 @@ type GridFrom = "top-left" | "top-right" | "bottom-left" | "bottom-right" | "cen
| Field | Type | What it is |
| --- | --- | --- |
| `kind` (required) | `"sequence" \| "parallel"` | – |
| `steps` (required) | `Step[]` | – |
| `kind` (required) | `"sequence" \| "parallel"` | sequence: one after another; parallel: together |
| `steps` (required) | `Step[]` | its steps, in order |
| `gap` (required) | `number` | frames between steps of a sequence (negative overlaps) |
### `Guard`
@@ -1119,9 +1112,9 @@ type InputTimeline = Record<number, Partial<FrameInput> | undefined>
| Field | Type | What it is |
| --- | --- | --- |
| `easing` | `EasingFn \| EasingFn[]` | – |
| `extrapolateLeft` | `ExtrapolateMode` | – |
| `extrapolateRight` | `ExtrapolateMode` | – |
| `easing` | `EasingFn \| EasingFn[]` | the curve between keyframes: one for all, or one a segment |
| `extrapolateLeft` | `ExtrapolateMode` | below the first keyframe: extend the line (default), clamp to it, identity (the input itself) or wrap |
| `extrapolateRight` | `ExtrapolateMode` | past the last keyframe: extend (default), clamp, identity or wrap |
### `Keys`
@@ -1140,8 +1133,8 @@ The props of [`Loop`](#loop), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `id` (required) | `string` | – |
| `key` (required) | `K` | – |
| `id` (required) | `string` | the machine's name in traces and reports |
| `key` (required) | `K` | the context's field holding its snapshot ("sm") |
| `states` (required) | `readonly N[]` | every state, in definition order (outer before inner) |
| `edges` (required) | `readonly Edge<N>[]` | every transition, in the order they're checked within a state |
| `start` (required) | `() => Snapshot<N>` | a snapshot before the first step: the first step enters the initial states (running their entry actions) |
@@ -1159,8 +1152,8 @@ The props of [`Loop`](#loop), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `id` (required) | `string` | the machine's name in traces and reports |
| `initial` (required) | `NoInfer<N>` | – |
| `states` (required) | `{ [S in N]?: StateConfig<C, E, N> }` | – |
| `initial` (required) | `NoInfer<N>` | the state it starts in |
| `states` (required) | `{ [S in N]?: StateConfig<C, E, N> }` | its states by name, each a StateConfig (substates nest inside) |
| `key` | `K` | the context's field holding the snapshot ("sm") |
| `strict` | `boolean` | refuse unreachable states and non-final dead ends when the machine is built (true) |
@@ -1168,22 +1161,22 @@ The props of [`Loop`](#loop), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `src` (required) | `string` | – |
| `startFrom` | `number` | – |
| `endAt` | `number` | – |
| `trimBefore` | `number` | – |
| `trimAfter` | `number` | – |
| `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) |
| `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) |
| `fadeOut` | `number` | ours: seconds to ramp the sound out to silence at its end |
| `playbackRate` | `number` | – |
| `muted` | `boolean` | – |
| `loop` | `boolean` | – |
| `playbackRate` | `number` | how fast it plays (1): 2 is double speed |
| `muted` | `boolean` | play no sound |
| `loop` | `boolean` | start again from `startFrom` when it reaches `endAt` |
| `bus` | `string` | the bus it plays into: a named channel of the edit's Tone graph (music, sfx, voice, ambience, ui), so it takes that bus's volume, effects and ducking (raea/tone `buses`) |
| `name` | `string` | – |
| `className` | `string` | – |
| `style` | `CSSProperties` | – |
| `name` | `string` | the entity's name, for picking, the inspector and world.* |
| `className` | `string` | Tailwind or CSS classes |
| `style` | `CSSProperties` | inline style |
### `MixProps`
@@ -1195,7 +1188,7 @@ Tracks by property, in frames from the move's own start.
| Field | Type | What it is |
| --- | --- | --- |
| `tracks` (required) | `Record<string, TrackSpec \| TrackSpec[]>` | – |
| `tracks` (required) | `Record<string, TrackSpec \| TrackSpec[]>` | keyframes by property, in frames from the move's start |
| `frames` (required) | `number` | how long it runs (its last key) |
### `MoveLike`
@@ -1221,9 +1214,9 @@ panel's state.
| Field | Type | What it is |
| --- | --- | --- |
| `about` (required) | `string` | – |
| `args` | `Record<string, string>` | – |
| `run` (required) | `(state: S, args: A) => S` | – |
| `about` (required) | `string` | what the action does, for the agent |
| `args` | `Record<string, string>` | its arguments by name, a few words each |
| `run` (required) | `(state: S, args: A) => S` | the panel's state after it |
### `PanelActions`
@@ -1237,8 +1230,8 @@ What perception saw at this frame: the largest face, and the platform's safe are
| Field | Type | What it is |
| --- | --- | --- |
| `face` | `Rect` | – |
| `safe` | `{ top?: number; bottom?: number }` | – |
| `face` | `Rect` | the largest face's box, when there's one |
| `safe` | `{ top?: number; bottom?: number }` | px the platform's UI covers at the top and bottom |
### `Plan`
@@ -1246,8 +1239,8 @@ A timeline's plan: each part's start frame and move, and the whole length.
| Field | Type | What it is |
| --- | --- | --- |
| `parts` (required) | `Record<string, { at: number; move: Move }>` | – |
| `frames` (required) | `number` | – |
| `parts` (required) | `Record<string, { at: number; move: Move }>` | each part's start frame and move, by its name |
| `frames` (required) | `number` | the whole timeline's length in frames |
### `Playtest`
@@ -1271,21 +1264,21 @@ whatever it plays is an input timeline `raea render --input` turns back into the
| Field | Type | What it is |
| --- | --- | --- |
| `width` (required) | `number` | – |
| `height` (required) | `number` | – |
| `face` | `Rect` | – |
| `parts` (required) | `ProofPart[]` | – |
| `width` (required) | `number` | the composition's width, px |
| `height` (required) | `number` | the composition's height, px |
| `face` | `Rect` | the face's box, when perception found one |
| `parts` (required) | `ProofPart[]` | the measured boxes of the parts to check |
### `ProofPart`
| Field | Type | What it is |
| --- | --- | --- |
| `name` (required) | `string` | – |
| `name` (required) | `string` | the part's name, in the faults |
| `band` | `[number, number]` | the band the part must fit in, [top, bottom] in px |
| `x` (required) | `number` | – |
| `y` (required) | `number` | – |
| `w` (required) | `number` | – |
| `h` (required) | `number` | – |
| `x` (required) | `number` | the left edge, px |
| `y` (required) | `number` | the top edge, px |
| `w` (required) | `number` | width, px |
| `h` (required) | `number` | height, px |
### `RaeaCSSProperties`
@@ -1303,10 +1296,10 @@ A box in composition px.
| Field | Type | What it is |
| --- | --- | --- |
| `x` (required) | `number` | – |
| `y` (required) | `number` | – |
| `w` (required) | `number` | – |
| `h` (required) | `number` | – |
| `x` (required) | `number` | the left edge, px |
| `y` (required) | `number` | the top edge, px |
| `w` (required) | `number` | width, px |
| `h` (required) | `number` | height, px |
### `RegionBox`
@@ -1314,11 +1307,11 @@ The band a Region occupies, in composition px.
| Field | Type | What it is |
| --- | --- | --- |
| `name` (required) | `RegionName` | – |
| `x` (required) | `number` | – |
| `y` (required) | `number` | – |
| `w` (required) | `number` | – |
| `h` (required) | `number` | – |
| `name` (required) | `RegionName` | the band it took: top, bottom, center or full ("auto" resolves to top or bottom) |
| `x` (required) | `number` | the left edge, px |
| `y` (required) | `number` | the top edge, px |
| `w` (required) | `number` | width, px |
| `h` (required) | `number` | height, px |
### `RegionName`
@@ -1334,13 +1327,13 @@ The props of [`Region`](#region), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `id` (required) | `string` | – |
| `component` (required) | `ComponentType<any>` | – |
| `width` (required) | `number` | – |
| `height` (required) | `number` | – |
| `fps` (required) | `number` | – |
| `durationInFrames` (required) | `number` | – |
| `defaultProps` (required) | `Record<string, unknown>` | – |
| `id` (required) | `string` | the composition's id: letters, digits and dashes (`raea render --composition` picks it) |
| `component` (required) | `ComponentType<any>` | the React component it renders |
| `width` (required) | `number` | in px |
| `height` (required) | `number` | in px |
| `fps` (required) | `number` | frames a second |
| `durationInFrames` (required) | `number` | its length in frames |
| `defaultProps` (required) | `Record<string, unknown>` | the props it's rendered with (JSON-like values only) |
### `SequenceLayout`
@@ -1356,14 +1349,14 @@ The props of [`Sequence`](#sequence), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `offset` | `number` | – |
| `height` | `number` | – |
| `style` | `CSSProperties` | – |
| `children` | `ReactNode` | – |
| `className` | `string` | – |
| `name` | `string` | – |
| `width` | `number` | – |
| `durationInFrames` | `number` | – |
| `offset` | `number` | frames from the previous slot's end to this one's start (0); negative overlaps |
| `height` | `number` | the height its children see, px (the parent's by default) |
| `style` | `CSSProperties` | the wrapping box's style |
| `children` | `ReactNode` | what plays in it, at its own local time |
| `className` | `string` | the wrapping box's classes |
| `name` | `string` | its label in the timeline and the render manifest (`data-sequence`) |
| `width` | `number` | the width its children see, px (the parent's by default) |
| `durationInFrames` | `number` | how many frames it shows its children (forever by default) |
### `Snapshot`
@@ -1374,20 +1367,20 @@ guard); `hist` is each history state's last substate.
| Field | Type | What it is |
| --- | --- | --- |
| `path` (required) | `N[]` | – |
| `at` (required) | `number[]` | – |
| `n` (required) | `number` | – |
| `e` (required) | `number` | – |
| `by` | `string` | – |
| `hist` | `{ [S in N]?: N }` | – |
| `path` (required) | `N[]` | the active states, outermost first ([] before the first step) |
| `at` (required) | `number[]` | the step each state in `path` was entered on |
| `n` (required) | `number` | the machine's steps so far, from 0 |
| `e` (required) | `number` | the edge the last transition took, an index into `machine.edges` |
| `by` | `string` | the decider that chose the last transition (absent: a guard did) |
| `hist` | `{ [S in N]?: N }` | each history state's last substate |
### `Song`
| Field | Type | What it is |
| --- | --- | --- |
| `map` (required) | `SongMap` | – |
| `fps` (required) | `number` | – |
| `offset` (required) | `number` | – |
| `map` (required) | `SongMap` | the song's map, from \`raea song\` |
| `fps` (required) | `number` | the composition's frame rate, that frames are counted in |
| `offset` (required) | `number` | seconds into the song frame 0 falls on (0) |
| `frame` (required) | `(seconds: number) => number` | the frame a song time falls on |
| `seconds` (required) | `(frame: number) => number` | the song's seconds at a frame |
| `at` (required) | `(frame: number) => SongMoment` | where the song is at a frame |
@@ -1400,32 +1393,32 @@ guard); `hist` is each history state's last substate.
| Field | Type | What it is |
| --- | --- | --- |
| `time` (required) | `number` | – |
| `beat` (required) | `number` | – |
| `beats` (required) | `number` | – |
| `energy` (required) | `number` | – |
| `cuts` (required) | `number` | – |
| `time` (required) | `number` | seconds from the song's start where the bar begins (its downbeat) |
| `beat` (required) | `number` | the index of its first beat |
| `beats` (required) | `number` | how many beats it holds |
| `energy` (required) | `number` | its mean energy, 0..1 |
| `cuts` (required) | `number` | suggested cuts in this bar: 0.25, 0.5, 1, 2 or 4 |
### `SongEvent`
| Field | Type | What it is |
| --- | --- | --- |
| `kind` (required) | `SongEventKind` | – |
| `kind` (required) | `SongEventKind` | what the event is: build, drop, stop, hit, dip or break |
| `time` (required) | `number` | seconds from the song's start: a beat (drop, a downbeat) or the grid's nearest beat or half beat (hit) |
| `end` | `number` | spans (build, stop, dip, break) end here |
| `beat` (required) | `number` | – |
| `bar` (required) | `number` | – |
| `beats` | `number` | – |
| `beat` (required) | `number` | the index of the beat it starts on, in `SongMap.beats` |
| `bar` (required) | `number` | the index of the bar it starts in |
| `beats` | `number` | a span: how many beats it lasts |
| `strength` (required) | `number` | 0..1 |
| `into` | `number \| null` | a build or stop: the drop it leads into, seconds |
| `hits` | `SongHit[]` | a stop: its sparse hits |
| `rise` | `number` | a drop: the energy of the bar after minus the bar before (negative when the band cuts after one big hit) |
| `holds` | `boolean` | a drop: the bar after stays up (false: one hit, then the band cuts out) |
| `afterStop` | `boolean` | – |
| `afterBuild` | `boolean` | – |
| `afterStop` | `boolean` | a drop: it comes straight out of a stop |
| `afterBuild` | `boolean` | a drop: it lands at the end of a build (within two bars of it) |
| `gapBefore` | `boolean` | a drop: a breath of near-silence just before it |
| `at` | `number` | a hit: the onset's own time; how far over the groove it stands |
| `over` | `number` | – |
| `over` | `number` | a hit: how far over the groove it stands |
### `SongEventKind`
@@ -1437,12 +1430,12 @@ type SongEventKind = "build" | "drop" | "stop" | "hit" | "dip" | "break"
| Field | Type | What it is |
| --- | --- | --- |
| `loudness` (required) | `number[]` | – |
| `onsets` (required) | `number[]` | – |
| `brightness` (required) | `number[]` | – |
| `low` (required) | `number[]` | – |
| `high` (required) | `number[]` | – |
| `energy` (required) | `number[]` | – |
| `loudness` (required) | `number[]` | loudness (RMS) a beat, 0..1 over the song |
| `onsets` (required) | `number[]` | onset strength (spectral flux) a beat, 0..1: how much is struck |
| `brightness` (required) | `number[]` | brightness (spectral centroid) a beat, 0..1 |
| `low` (required) | `number[]` | the low end (kick and bass, under 150 Hz) a beat, 0..1 |
| `high` (required) | `number[]` | the high band (over 3 kHz) a beat, 0..1 |
| `energy` (required) | `number[]` | the combined energy a beat, 0..1: loudness, low end, onsets and highs together |
### `SongHit`
@@ -1450,9 +1443,9 @@ A hit inside a stop: `time` on the beat grid (a beat or half beat), `at` where t
| Field | Type | What it is |
| --- | --- | --- |
| `time` (required) | `number` | – |
| `at` (required) | `number` | – |
| `strength` (required) | `number` | – |
| `time` (required) | `number` | seconds from the song's start, snapped to the beat grid (a beat or half beat) |
| `at` (required) | `number` | seconds from the song's start where the onset itself is |
| `strength` (required) | `number` | how hard the hit is, 0..1 |
### `SongLevel`
@@ -1464,19 +1457,19 @@ type SongLevel = "intro" | "low" | "mid" | "high" | "outro"
| Field | Type | What it is |
| --- | --- | --- |
| `version` (required) | `number` | – |
| `duration` (required) | `number` | – |
| `tempo` (required) | `number \| null` | – |
| `beatsPerBar` (required) | `number` | – |
| `beats` (required) | `number[]` | – |
| `downbeats` (required) | `number[]` | – |
| `version` (required) | `number` | the map format's version (1) |
| `duration` (required) | `number` | the song's length in seconds |
| `tempo` (required) | `number \| null` | beats per minute, or null when no beat was found |
| `beatsPerBar` (required) | `number` | beats in a bar (4 for 4/4) |
| `beats` (required) | `number[]` | every beat's time in seconds, ascending |
| `downbeats` (required) | `number[]` | every bar's first beat, in seconds |
| `features` (required) | `SongFeatures` | one value a beat, 0..1 over the song |
| `bars` (required) | `SongBar[]` | – |
| `sections` (required) | `SongSection[]` | – |
| `events` (required) | `SongEvent[]` | – |
| `sectionsFrom` | `"markers" \| "novelty"` | – |
| `boundaries` | `{ time: number; beat: number; bar: number; strength: number }[]` | – |
| `source` | `string \| null` | – |
| `bars` (required) | `SongBar[]` | the bars in order, each with its energy and suggested cut rate |
| `sections` (required) | `SongSection[]` | the song's sections in order (intro, verse, chorus and so on) |
| `events` (required) | `SongEvent[]` | builds, drops, stops, hits, dips and breaks, in time order |
| `sectionsFrom` | `"markers" \| "novelty"` | where the sections came from: the song file's markers, or novelty in the music itself |
| `boundaries` | `{ time: number; beat: number; bar: number; strength: number }[]` | the candidate section boundaries novelty found, each with its strength 0..1 |
| `source` | `string \| null` | the song file's name |
### `SongMoment`
@@ -1484,30 +1477,30 @@ Where a moment of the song is. Seconds are the song's; infinities when there's n
| Field | Type | What it is |
| --- | --- | --- |
| `time` (required) | `number` | – |
| `time` (required) | `number` | the moment, seconds from the song's start |
| `beat` (required) | `number` | the beat at or before `time` (-1 before the first) |
| `bar` (required) | `number` | the bar at or before `time` (-1 before the first beat) |
| `beatInBar` (required) | `number` | 0-based position in the bar |
| `phase` (required) | `number` | 0..1 through the beat, and through the bar |
| `barPhase` (required) | `number` | – |
| `barPhase` (required) | `number` | 0..1 through the bar |
| `energy` (required) | `number` | the features at `time`, interpolated between beats |
| `loudness` (required) | `number` | – |
| `onsets` (required) | `number` | – |
| `brightness` (required) | `number` | – |
| `low` (required) | `number` | – |
| `section` (required) | `SongSection \| null` | – |
| `sectionIndex` (required) | `number` | – |
| `loudness` (required) | `number` | loudness at `time`, 0..1 |
| `onsets` (required) | `number` | onset strength at `time`, 0..1 |
| `brightness` (required) | `number` | brightness at `time`, 0..1 |
| `low` (required) | `number` | the low end at `time`, 0..1 |
| `section` (required) | `SongSection \| null` | the section `time` is in (null before the first) |
| `sectionIndex` (required) | `number` | that section's index in `SongMap.sections` (-1 for none) |
| `sectionProgress` (required) | `number` | 0..1 through the section |
| `cutsPerBar` (required) | `number` | the bar's suggested cut rate (cuts per bar) |
| `drop` (required) | `SongEvent \| null` | the last drop at or before `time`, the next after it |
| `nextDrop` (required) | `SongEvent \| null` | – |
| `sinceDrop` (required) | `number` | – |
| `untilDrop` (required) | `number` | – |
| `nextDrop` (required) | `SongEvent \| null` | the next drop after `time` |
| `sinceDrop` (required) | `number` | seconds since the last drop (Infinity when there's none) |
| `untilDrop` (required) | `number` | seconds until the next drop (Infinity when there's none) |
| `build` (required) | `SongEvent \| null` | the build `time` is in, and 0..1 through it |
| `inBuild` (required) | `boolean` | – |
| `buildProgress` (required) | `number` | – |
| `inBuild` (required) | `boolean` | whether `time` is inside a build |
| `buildProgress` (required) | `number` | 0..1 through that build |
| `stop` (required) | `SongEvent \| null` | the stop `time` is in |
| `inStop` (required) | `boolean` | – |
| `inStop` (required) | `boolean` | whether `time` is inside a stop |
| `dip` (required) | `SongEvent \| null` | the dip or break `time` is in |
| `next` (required) | `SongEvent \| null` | the next event of any kind after `time` |
@@ -1526,37 +1519,37 @@ The props of [`SongPlot`](#songplot), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `name` (required) | `string` | – |
| `level` (required) | `SongLevel` | – |
| `time` (required) | `number` | – |
| `end` (required) | `number` | – |
| `beat` (required) | `number` | – |
| `bar` (required) | `number` | – |
| `energy` (required) | `number` | – |
| `name` (required) | `string` | the section's marker name when the song file has markers, else its level |
| `level` (required) | `SongLevel` | how high the section sits in the song: intro, low, mid, high or outro |
| `time` (required) | `number` | seconds from the song's start where the section begins |
| `end` (required) | `number` | seconds from the song's start where it ends |
| `beat` (required) | `number` | the index of its first beat |
| `bar` (required) | `number` | the index of its first bar |
| `energy` (required) | `number` | its mean energy, 0..1 |
| `cuts` (required) | `number` | suggested cuts per bar: 0.25, 0.5, 1, 2 or 4 |
### `SpringConfig`
| Field | Type | What it is |
| --- | --- | --- |
| `mass` | `number` | – |
| `damping` | `number` | – |
| `stiffness` | `number` | – |
| `overshootClamping` | `boolean` | – |
| `mass` | `number` | how heavy the spring's weight is (1): heavier is slower and swings further |
| `damping` | `number` | how fast the swing dies (10): lower bounces more |
| `stiffness` | `number` | how hard the spring pulls (100): stiffer is quicker |
| `overshootClamping` | `boolean` | stop at `to` the first time it gets there, with no overshoot (false) |
### `SpringOptions`
| Field | Type | What it is |
| --- | --- | --- |
| `frame` (required) | `number` | – |
| `fps` (required) | `number` | – |
| `from` | `number` | – |
| `to` | `number` | – |
| `config` | `SpringConfig` | – |
| `durationInFrames` | `number` | – |
| `durationRestThreshold` | `number` | – |
| `delay` | `number` | – |
| `reverse` | `boolean` | – |
| `frame` (required) | `number` | the frame to sample, usually useCurrentFrame() |
| `fps` (required) | `number` | frames a second, from useVideoConfig() |
| `from` | `number` | the value it starts at (0) |
| `to` | `number` | the value it settles at (1) |
| `config` | `SpringConfig` | the spring: mass, damping, stiffness, overshootClamping |
| `durationInFrames` | `number` | stretch or squeeze the spring to settle in this many frames |
| `durationRestThreshold` | `number` | how close to `to`, as a share of the travel, counts as settled when timing it (0.005) |
| `delay` | `number` | frames before it starts (0) |
| `reverse` | `boolean` | play it backwards: from `to` back to `from` |
### `StaggerProps`
@@ -1565,16 +1558,16 @@ The props of [`SongPlot`](#songplot), tabled there.
| `each` (required) | `number` | frames between one child's entrance and the next |
| `grid` | `{ cols: number; rows?: number; from?: GridFrom }` | spread by grid distance instead of order |
| `exitEach` | `number` | the exit staggered too, `exitEach` frames apart (0: all together) |
| `style` | `CSSProperties` | – |
| `style` | `CSSProperties` | inline style |
| `animate` | `Record<string, TrackSpec \| TrackSpec[] \| Keys> \| Move` | free tracks by property, in local frames: `{ backgroundColor: track({ 0: "#fff", 20: "#000" }) }` |
| `as` | `string` | the element: "div" by default |
| `exit` | `MoveLike` | the exit, played at `exitAt` (an entrance reversed: `exit="rise"` sinks back out) |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | what moves |
| `enter` | `MoveLike` | the entrance: a move's name, a move, or several together |
| `at` | `number` | local frame the entrance starts (0) |
| `exitAt` | `number` | local frame the exit starts |
| `mount` | `"during" \| "always"` | "always" (default): in the tree, and its layout, the whole time (invisible before an entrance that fades in); "during": only from the entrance's start until the exit ends (it takes its space when it arrives) |
| `className` | `string` | – |
| `className` | `string` | Tailwind or CSS classes |
### `StateConfig`
@@ -1592,7 +1585,7 @@ The props of [`SongPlot`](#songplot), tabled there.
| `history` | `"shallow" \| "deep"` | re-entering this compound state resumes the substate it left ("shallow"), or that substate's own (deep) |
| `onDone` | `Transitions<C, E, N>` | a compound state's transition taken when its active substate is final |
| `type` | `"final"` | a final state: no transitions out (a dead enemy, the game won, the work shipped) |
| `description` | `string` | – |
| `description` | `string` | what the state means, for reports and a decider |
### `StateName`
@@ -1624,7 +1617,7 @@ What a step may be given besides the context and env.
| Field | Type | What it is |
| --- | --- | --- |
| `text` (required) | `string` | – |
| `text` (required) | `string` | the word as spoken |
| `from` (required) | `number` | first frame of the word |
| `to` (required) | `number` | frame after the word ends (exclusive) |
@@ -1634,14 +1627,14 @@ One property's keyframes: values by frame, the curve between each pair (one for
| Field | Type | What it is |
| --- | --- | --- |
| `keys` (required) | `[number, V][]` | – |
| `ease` (required) | `Curve \| Curve[]` | – |
| `unit` | `"px" \| "%"` | – |
| `repeat` | `"hold" \| "loop" \| "pingpong" \| `${"loop" \| "pingpong"}:${number}`` | – |
| `digits` | `number` | – |
| `keys` (required) | `[number, V][]` | [frame, value] pairs in frame order, frames from the move's start |
| `ease` (required) | `Curve \| Curve[]` | the curve between keys: one for all, or one a segment |
| `unit` | `"px" \| "%"` | a length's unit: px (the default) or % |
| `repeat` | `"hold" \| "loop" \| "pingpong" \| `${"loop" \| "pingpong"}:${number}`` | past the last key: hold (the default), loop or pingpong, for ever or N times ("loop:3") |
| `digits` | `number` | decimals a `text` counter writes |
| `prefix` | `string` | a `text` counter's text before and after the number, and between its thousands ("," writes 12,345) |
| `suffix` | `string` | – |
| `separator` | `string` | – |
| `suffix` | `string` | written after a `text` counter's number (" pts") |
| `separator` | `string` | between a `text` counter's thousands ("," writes 12,345) |
### `TransitionConfig`
@@ -1659,14 +1652,14 @@ null for the first step's entry into the initial states.
| Field | Type | What it is |
| --- | --- | --- |
| `machine` (required) | `string` | – |
| `step` (required) | `number` | – |
| `from` (required) | `string \| null` | – |
| `to` (required) | `string` | – |
| `edge` (required) | `number` | – |
| `kind` (required) | `Edge["kind"] \| "start"` | – |
| `machine` (required) | `string` | the machine's id |
| `step` (required) | `number` | the machine's step it happened on |
| `from` (required) | `string \| null` | the leaf it left (null for the first entry) |
| `to` (required) | `string` | the leaf it entered |
| `edge` (required) | `number` | the edge it took, an index into `machine.edges` |
| `kind` (required) | `Edge["kind"] \| "start"` | what kind of edge: always, after, on, choose, done (an onDone), or start for the first entry |
| `by` (required) | `string` | "guard" for a trigger, "start" for the first entry, else the decider's name |
| `evidence` | `unknown` | – |
| `evidence` | `unknown` | the decider's evidence for the choice |
### `Transitions`
@@ -1686,12 +1679,12 @@ type Transitions = | NoInfer<N> | TransitionConfig<C, E, N> | readonly (NoInfer<
| Field | Type | What it is |
| --- | --- | --- |
| `id` (required) | `string` | – |
| `width` (required) | `number` | – |
| `height` (required) | `number` | – |
| `fps` (required) | `number` | – |
| `durationInFrames` (required) | `number` | – |
| `defaultProps` (required) | `Record<string, unknown>` | – |
| `id` (required) | `string` | the composition's id ("main" by default) |
| `width` (required) | `number` | in px |
| `height` (required) | `number` | in px |
| `fps` (required) | `number` | frames a second |
| `durationInFrames` (required) | `number` | its length in frames |
| `defaultProps` (required) | `Record<string, unknown>` | the props the composition is rendered with |
### `VideoProps`
@@ -1709,8 +1702,8 @@ A machine's state in some context, for a trace (`Playtest.machines`).
| Field | Type | What it is |
| --- | --- | --- |
| `machine` (required) | `AnyMachine` | – |
| `snapshot` (required) | `Snapshot` | – |
| `machine` (required) | `AnyMachine` | the machine |
| `snapshot` (required) | `Snapshot` | its runtime state in that context |
### `WordOptions`
+5 -6
View File
@@ -36,11 +36,10 @@ insert, query and step it, and add TypeScript systems to its schedules.
| Member | What it does |
| --- | --- |
| `new BevyApp(id: number, methods: string[])` | – |
| `BevyApp.open(o: OpenOptions): BevyApp` | A headless App with these plugins; Startup has run, no frame has stepped. TypeScript plugins are built in order once the App is open, then finished and cleaned up; their Startup systems run before the first frame. |
| `BevyApp.stepTogether(apps: BevyApp[], frames?: number): number[]` | Apps stepped together, a frame at a time: a network's peers. Returns each one's frame. |
| `.methods: string[]` | the methods this App answers (BRP's, raea's and its plugins') |
| `.id: number` | – |
| `.id: number` | the App's handle in the engine |
| `.isPluginAdded(name: string): boolean` | Whether a plugin of this name is in the App (Bevy's is_plugin_added), Rust or TypeScript. |
| `.addPlugins(...refs: PluginRef[]): BevyApp` | Adds TypeScript plugins and groups (Bevy's add_plugins): each built in order, then each finished, then each cleaned up. A Rust plugin is compiled in and must be named when the App opens; naming a new one here throws. |
| `.addSystems(schedule: string, systems: ((app: BevyApp, frame: number) => void) \| ((app: BevyApp, frame: number) => void)[], o?: SystemOptions): BevyApp` | Systems in a schedule (Bevy's add_systems), each as `system` adds one; one of the startup schedules (PreStartup, Startup, PostStartup) runs them once, before the App's next frame. Returns the App, to chain. |
@@ -53,11 +52,11 @@ insert, query and step it, and add TypeScript systems to its schedules.
| `.frameSchedules(): string[]` | The schedules a frame runs, in order (Bevy's MainScheduleOrder). |
| `.call<A = unknown>(method: string, params?: unknown): A` | Any method of the App's table, run now: its answer, or a throw with the method's message. |
| `.spawn(...components: With[]): number` | A new entity with these components. |
| `.insert(entity: number, ...components: With[]): void` | – |
| `.insert(entity: number, ...components: With[]): void` | Adds these components to an entity, replacing any it has of the same type. |
| `.get<T>(entity: number, c: Component<T>): T \| undefined` | One component of an entity, or undefined when it hasn't got one. |
| `.query(o: { data?: Component<unknown>[] \| undefined; has?: Component<unknown>[] \| undefined; without?: Component<unknown>[] \| undefined; }): { entity: number…` | Entities with every component in `has` (and none in `without`), with the `data` components' values. |
| `.resource<T>(r: Resource<T>): T` | – |
| `.setResource<T>(r: Resource<T>, value: T): void` | – |
| `.resource<T>(r: Resource<T>): T` | A resource's value. |
| `.setResource<T>(r: Resource<T>, value: T): void` | Sets a resource's value, adding it if the app hasn't got one. |
| `.trigger<T>(e: Event<T>, value: T): void` | Triggers an event: its observers run now. |
| `.write<T>(m: Message<T>, value: T): void` | Writes a message, for its readers' next run. |
| `.observe<T>(e: Event<T>, entity?: number \| undefined): () => T[]` | Starts observing an event (BRP's world.observe+watch). Each call of the returned function gives the events triggered since the last call, in order. `entity` limits it to events aimed at that entity. |
@@ -66,7 +65,7 @@ insert, query and step it, and add TypeScript systems to its schedules.
| `.state<T>(s: State<T>): T \| null` | A state's value (null before it exists). |
| `.setState<T>(s: State<T>, value: T): void` | A state's next value: it changes at the next frame's StateTransition. |
| `.schema(crates?: string[] \| undefined): Record<string, unknown>` | The App's registered types as JSON schema (BRP's registry.schema), filtered by crate. |
| `.close(): void` | – |
| `.close(): void` | Shuts the app down; its methods fail after. |
## Types
+102 -104
View File
@@ -147,11 +147,9 @@ Used in: [2d/2d_shapes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/
bevy_math's Rectangle (half_size [0.5, 0.5] by default)
Bevy: `bevy_shape::Rectangle`.
| Prop | Type | What it does |
| --- | --- | --- |
| `half_size` | `Vec2` | Bevy: Half of the width and height of the rectangle |
| `half_size` | `Vec2` | half its width and height |
Also takes the props of [`MeshAttributes`](#meshattributes) (`vertex_colors`); [`RingProps`](#ringprops) (`ring`, `inner`).
@@ -231,9 +229,9 @@ Bevy: `bevy_image::texture_atlas_builder::TextureAtlasBuilder`, `bevy_image::tex
| Member | What it does |
| --- | --- |
| `.padding(p: [number, number]): TextureAtlasBuilder` | – |
| `.addTexture(src: string): TextureAtlasBuilder` | – |
| `.build({ sampler }?: { sampler?: SamplerSpec \| undefined; }): BuiltAtlas` | – |
| `.padding(p: [number, number]): TextureAtlasBuilder` | Whole px of space around each picture, [x, y]. |
| `.addTexture(src: string): TextureAtlasBuilder` | Adds a picture, packed in the order added. |
| `.build({ sampler }?: { sampler?: SamplerSpec \| undefined; }): BuiltAtlas` | Packs the atlas, with its own sampler if given (Bevy's default otherwise). |
Used in: [2d/texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/2d/texture_atlas.tsx).
@@ -257,10 +255,10 @@ an arc: its radius and half its angle in radians (Bevy's CircularSector::new(r,
| Field | Type | What it is |
| --- | --- | --- |
| `arc` | `{ radius: number; half_angle: number }` | – |
| `vertex_colors` | `(LinearRgba \| [number, number, number, number])[]` | – |
| `ring` | `number` | – |
| `inner` | `Record<string, unknown>` | – |
| `arc` | `{ radius: number; half_angle: number }` | its radius and half its angle in radians |
| `vertex_colors` | `(LinearRgba \| [number, number, number, number])[]` | one linear colour a vertex, in the mesh's vertex order (ATTRIBUTE_COLOR) |
| `ring` | `number` | a thickness: the shape made a ring that thick (to_ring) |
| `inner` | `Record<string, unknown>` | the ring's inner shape, as the same shape's fields |
### `AtlasSprite`
@@ -268,9 +266,9 @@ What a <Sprite> takes to show a built atlas: the whole of it, or one of its pict
| Field | Type | What it is |
| --- | --- | --- |
| `src` (required) | `string` | – |
| `sampler` | `SamplerSpec` | – |
| `atlasPick` | `number` | – |
| `src` (required) | `string` | the atlas picture |
| `sampler` | `SamplerSpec` | how it's sampled (the atlas's own sampler) |
| `atlasPick` | `number` | which of its pictures shows (the whole atlas when left out) |
### `BuiltAtlas`
@@ -279,8 +277,8 @@ A built atlas: `image` the whole atlas as a sprite's picture, `sources.handle(te
| Field | Type | What it is |
| --- | --- | --- |
| `image` (required) | `AtlasSprite` | – |
| `sources` (required) | `{ handle(texture: string): AtlasSprite }` | – |
| `image` (required) | `AtlasSprite` | the whole atlas, as a sprite's picture |
| `sources` (required) | `{ handle(texture: string): AtlasSprite }` | \`handle(texture)\`: one of the pictures packed into it, by its file |
### `Capsule2dProps`
@@ -302,26 +300,26 @@ The props of [`Ellipse`](#ellipse), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `transform` | `TransformValue` | – |
| `visibility` | `"Inherited" \| "Visible" \| "Hidden"` | – |
| `transform` | `TransformValue` | where it stands: translation, rotation (a quaternion) and scale |
| `visibility` | `"Inherited" \| "Visible" \| "Hidden"` | "Hidden" draws nothing; "Visible" and "Inherited" draw |
| `children` | `ReactNode` | one of bevy_math's 2D primitives (<Circle>, <Capsule2d>,...) and a <ColorMaterial>, or your own <Material> |
| `name` | `string` | – |
| `onClick` | `(e: Event3d) => void` | – |
| `onDrag` | `(e: Event3d) => void` | – |
| `onDragEnd` | `(e: Event3d) => void` | – |
| `onDragEnter` | `(e: Event3d) => void` | – |
| `onDragLeave` | `(e: Event3d) => void` | – |
| `onDragOver` | `(e: Event3d) => void` | – |
| `onDragStart` | `(e: Event3d) => void` | – |
| `onDrop` | `(e: Event3d) => void` | – |
| `onPointerDown` | `(e: Event3d) => void` | – |
| `onPointerMove` | `(e: Event3d) => void` | – |
| `onPointerUp` | `(e: Event3d) => void` | – |
| `onPointerEnter` | `(e: Event3d) => void` | – |
| `onPointerLeave` | `(e: Event3d) => void` | – |
| `onPointerOver` | `(e: Event3d) => void` | – |
| `onPointerOut` | `(e: Event3d) => void` | – |
| `onWheel` | `(e: Event3d) => void` | – |
| `name` | `string` | the entity's name, for picking, the inspector and world.* |
| `onClick` | `(e: Event3d) => void` | a press and release over the part |
| `onDrag` | `(e: Event3d) => void` | the part pressed is being dragged, each frame it moves |
| `onDragEnd` | `(e: Event3d) => void` | the drag of the part pressed ended |
| `onDragEnter` | `(e: Event3d) => void` | a dragged part came over this one (`dragged` names it) |
| `onDragLeave` | `(e: Event3d) => void` | a dragged part left this one |
| `onDragOver` | `(e: Event3d) => void` | a dragged part is over this one |
| `onDragStart` | `(e: Event3d) => void` | a drag began on the part pressed |
| `onDrop` | `(e: Event3d) => void` | a dragged part was dropped on this one |
| `onPointerDown` | `(e: Event3d) => void` | a button pressed over the part |
| `onPointerMove` | `(e: Event3d) => void` | the pointer moved over the part |
| `onPointerUp` | `(e: Event3d) => void` | a button released over the part |
| `onPointerEnter` | `(e: Event3d) => void` | the pointer came over the part (doesn't bubble) |
| `onPointerLeave` | `(e: Event3d) => void` | the pointer left the part (doesn't bubble) |
| `onPointerOver` | `(e: Event3d) => void` | the pointer came over the part (bubbles, as the DOM's) |
| `onPointerOut` | `(e: Event3d) => void` | the pointer left the part (bubbles) |
| `onWheel` | `(e: Event3d) => void` | the wheel turned over the part (`deltaX`, `deltaY`) |
| `quat` | `Quat` | Bevy's rotation as it is, a quaternion [x, y, z, w] in Bevy's axes (y up, z toward the viewer), in place of `rotation`: a turn out of the frame's plane too, as a Sprite's Transform takes it (camera/2d_on_ui) |
| `opacity` | `number` | 0 to 1 (1 by default) |
@@ -331,7 +329,7 @@ a primitive's mesh attributes: its Mesh::ATTRIBUTE_COLOR, one linear colour per
| Field | Type | What it is |
| --- | --- | --- |
| `vertex_colors` | `(LinearRgba \| [number, number, number, number])[]` | – |
| `vertex_colors` | `(LinearRgba \| [number, number, number, number])[]` | one linear colour a vertex, in the mesh's vertex order (ATTRIBUTE_COLOR) |
### `Place2dProps`
@@ -340,30 +338,30 @@ pointer and drag handlers, called as a 3D part's are (2D parts are picked first,
| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | – |
| `x` | `number` | – |
| `y` | `number` | – |
| `name` | `string` | the entity's name, for picking, the inspector and world.* |
| `x` | `number` | px from the frame's left edge to the part's centre |
| `y` | `number` | px from the frame's top edge to the part's centre, down positive |
| `rotation` | `number` | radians, clockwise (as CSS rotate) |
| `quat` | `Quat` | Bevy's rotation as it is, a quaternion [x, y, z, w] in Bevy's axes (y up, z toward the viewer), in place of `rotation`: a turn out of the frame's plane too, as a Sprite's Transform takes it (camera/2d_on_ui) |
| `scale` | `number \| [number, number]` | 1 by default; [x, y] to stretch |
| `z` | `number` | draw order among the 2D parts: higher draws over lower (0 by default) |
| `opacity` | `number` | 0 to 1 (1 by default) |
| `onClick` | `(e: Event3d) => void` | – |
| `onPointerDown` | `(e: Event3d) => void` | – |
| `onPointerUp` | `(e: Event3d) => void` | – |
| `onPointerOver` | `(e: Event3d) => void` | – |
| `onPointerOut` | `(e: Event3d) => void` | – |
| `onPointerEnter` | `(e: Event3d) => void` | – |
| `onPointerLeave` | `(e: Event3d) => void` | – |
| `onPointerMove` | `(e: Event3d) => void` | – |
| `onWheel` | `(e: Event3d) => void` | – |
| `onDragStart` | `(e: Event3d) => void` | – |
| `onDrag` | `(e: Event3d) => void` | – |
| `onDragEnd` | `(e: Event3d) => void` | – |
| `onDragEnter` | `(e: Event3d) => void` | – |
| `onDragOver` | `(e: Event3d) => void` | – |
| `onDragLeave` | `(e: Event3d) => void` | – |
| `onDrop` | `(e: Event3d) => void` | – |
| `onClick` | `(e: Event3d) => void` | a press and release over the part |
| `onPointerDown` | `(e: Event3d) => void` | a button pressed over the part |
| `onPointerUp` | `(e: Event3d) => void` | a button released over the part |
| `onPointerOver` | `(e: Event3d) => void` | the pointer came over the part (bubbles, as the DOM's) |
| `onPointerOut` | `(e: Event3d) => void` | the pointer left the part (bubbles) |
| `onPointerEnter` | `(e: Event3d) => void` | the pointer came over the part (doesn't bubble) |
| `onPointerLeave` | `(e: Event3d) => void` | the pointer left the part (doesn't bubble) |
| `onPointerMove` | `(e: Event3d) => void` | the pointer moved over the part |
| `onWheel` | `(e: Event3d) => void` | the wheel turned over the part (`deltaX`, `deltaY`) |
| `onDragStart` | `(e: Event3d) => void` | a drag began on the part pressed |
| `onDrag` | `(e: Event3d) => void` | the part pressed is being dragged, each frame it moves |
| `onDragEnd` | `(e: Event3d) => void` | the drag of the part pressed ended |
| `onDragEnter` | `(e: Event3d) => void` | a dragged part came over this one (`dragged` names it) |
| `onDragOver` | `(e: Event3d) => void` | a dragged part is over this one |
| `onDragLeave` | `(e: Event3d) => void` | a dragged part left this one |
| `onDrop` | `(e: Event3d) => void` | a dragged part was dropped on this one |
### `RectangleProps`
@@ -383,8 +381,8 @@ a 2D shape as Bevy's Ring: of it and `inner` (the same shape's fields), or its t
| Field | Type | What it is |
| --- | --- | --- |
| `ring` | `number` | – |
| `inner` | `Record<string, unknown>` | – |
| `ring` | `number` | a thickness: the shape made a ring that thick (to_ring) |
| `inner` | `Record<string, unknown>` | the ring's inner shape, as the same shape's fields |
### `Shape2DProps`
@@ -392,7 +390,7 @@ a 2D shape as Bevy's Ring: of it and `inner` (the same shape's fields), or its t
| --- | --- | --- |
| `shape` | `"rect" \| "circle" \| "ellipse" \| "triangle" \| "polygon"` | a rect by default; a polygon has `sides` (5 by default) |
| `size` | `[number, number]` | [width, height] in px ([100, 100] by default); a circle's and a polygon's diameter is the width |
| `sides` | `number` | – |
| `sides` | `number` | a polygon's number of sides (5) |
| `color` | `string` | a CSS colour (white by default); with a texture, it tints it |
| `srgb` | `[number, number, number]` | the colour as a Bevy Srgba's [r, g, b], unrounded, over `color` (a Mesh2d's ColorMaterial gives it) |
| `texture` | `string \| { path: string; sampler: SamplerSpec }` | a picture on it, mapped by the mesh's UVs (Bevy's ColorMaterial texture), or one with its own sampler (Bevy's load_with_settings: { path, sampler: { wrap: "repeat" } }) |
@@ -401,30 +399,30 @@ a 2D shape as Bevy's Ring: of it and `inner` (the same shape's fields), or its t
| `vertex_colors` | `[number, number, number, number][]` | one linear [r, g, b, a] per vertex of the shape's mesh (Bevy's Mesh::ATTRIBUTE_COLOR): the material's colour and texture are multiplied by them. A rect has 4 (top right, top left, bottom left, bottom right), a triangle 3. |
| `shader` | `Record<string, unknown>` | its own Material2d in place of the ColorMaterial: the spec a <Material> in a Mesh2d makes; the shape's colour, texture and alpha_mode are then the material's to draw |
| `primitive` | `Record<string, unknown>` | one of Bevy's 2D primitives in place of `shape`, its reflected fields over Bevy's default: { primitive: "Capsule2d", radius: 25, half_length: 25 }; a 2D shape given `inner` (the same shape's fields) is Bevy's Ring, or given `ring: thickness` its to_ring (raea-sys-mesh primitive_mesh). A Mesh2d's primitive child makes it. |
| `name` | `string` | – |
| `x` | `number` | – |
| `y` | `number` | – |
| `name` | `string` | the entity's name, for picking, the inspector and world.* |
| `x` | `number` | px from the frame's left edge to the part's centre |
| `y` | `number` | px from the frame's top edge to the part's centre, down positive |
| `rotation` | `number` | radians, clockwise (as CSS rotate) |
| `quat` | `Quat` | Bevy's rotation as it is, a quaternion [x, y, z, w] in Bevy's axes (y up, z toward the viewer), in place of `rotation`: a turn out of the frame's plane too, as a Sprite's Transform takes it (camera/2d_on_ui) |
| `scale` | `number \| [number, number]` | 1 by default; [x, y] to stretch |
| `z` | `number` | draw order among the 2D parts: higher draws over lower (0 by default) |
| `opacity` | `number` | 0 to 1 (1 by default) |
| `onClick` | `(e: Event3d) => void` | – |
| `onPointerDown` | `(e: Event3d) => void` | – |
| `onPointerUp` | `(e: Event3d) => void` | – |
| `onPointerOver` | `(e: Event3d) => void` | – |
| `onPointerOut` | `(e: Event3d) => void` | – |
| `onPointerEnter` | `(e: Event3d) => void` | – |
| `onPointerLeave` | `(e: Event3d) => void` | – |
| `onPointerMove` | `(e: Event3d) => void` | – |
| `onWheel` | `(e: Event3d) => void` | – |
| `onDragStart` | `(e: Event3d) => void` | – |
| `onDrag` | `(e: Event3d) => void` | – |
| `onDragEnd` | `(e: Event3d) => void` | – |
| `onDragEnter` | `(e: Event3d) => void` | – |
| `onDragOver` | `(e: Event3d) => void` | – |
| `onDragLeave` | `(e: Event3d) => void` | – |
| `onDrop` | `(e: Event3d) => void` | – |
| `onClick` | `(e: Event3d) => void` | a press and release over the part |
| `onPointerDown` | `(e: Event3d) => void` | a button pressed over the part |
| `onPointerUp` | `(e: Event3d) => void` | a button released over the part |
| `onPointerOver` | `(e: Event3d) => void` | the pointer came over the part (bubbles, as the DOM's) |
| `onPointerOut` | `(e: Event3d) => void` | the pointer left the part (bubbles) |
| `onPointerEnter` | `(e: Event3d) => void` | the pointer came over the part (doesn't bubble) |
| `onPointerLeave` | `(e: Event3d) => void` | the pointer left the part (doesn't bubble) |
| `onPointerMove` | `(e: Event3d) => void` | the pointer moved over the part |
| `onWheel` | `(e: Event3d) => void` | the wheel turned over the part (`deltaX`, `deltaY`) |
| `onDragStart` | `(e: Event3d) => void` | a drag began on the part pressed |
| `onDrag` | `(e: Event3d) => void` | the part pressed is being dragged, each frame it moves |
| `onDragEnd` | `(e: Event3d) => void` | the drag of the part pressed ended |
| `onDragEnter` | `(e: Event3d) => void` | a dragged part came over this one (`dragged` names it) |
| `onDragOver` | `(e: Event3d) => void` | a dragged part is over this one |
| `onDragLeave` | `(e: Event3d) => void` | a dragged part left this one |
| `onDrop` | `(e: Event3d) => void` | a dragged part was dropped on this one |
### `SpriteImageMode`
@@ -442,51 +440,51 @@ type SpriteImageMode = | "Auto" | { Scale: "FillCenter" | "FillStart" | "FillEnd
| --- | --- | --- |
| `src` (required) | `string` | a picture in the media folder: staticFile("hero.png"), or a "render:NAME" image a camera or a <Compute> draws (a frame may switch it to another by name) |
| `width` | `number` | size in px (the picture's, or one cell's, by default); one given, the other follows the picture's shape |
| `height` | `number` | – |
| `height` | `number` | in px; given alone, the width follows the picture's shape |
| `grid` | `[number, number]` | a sprite sheet: the picture is `[columns, rows]` cells of equal size, read left to right, top to bottom |
| `atlasPick` | `number` | one picture of a built atlas (TextureAtlasBuilder's sources.handle gives it with its src): its index in the atlas's list |
| `frame` | `number` | with `grid`: which cell shows (0 is the top left); animate it to play the sheet: frame={Math.floor(f / 3)} |
| `flipX` | `boolean` | – |
| `flipY` | `boolean` | – |
| `flipX` | `boolean` | mirrored left to right |
| `flipY` | `boolean` | mirrored top to bottom |
| `color` | `string` | a tint multiplied over the picture (white by default) |
| `tileX` | `boolean` | Bevy's SpriteImageMode::Tiled: the picture repeats across the sprite's width (tileX) or height (tileY) instead of stretching to it, a tile every `tileStretch` x the picture's size (1 by default): a floor, a fence, a wall. Animate width and height to show more or fewer tiles |
| `tileY` | `boolean` | – |
| `tileStretch` | `number` | – |
| `tileY` | `boolean` | tile the picture down its height instead of stretching it |
| `tileStretch` | `number` | a tile every this many times the picture's size (1) |
| `image_mode` | `SpriteImageMode` | Bevy's SpriteImageMode, as its reflected value: "Auto" (stretched to the size), { Scale: "FillCenter" } (and FillStart, FillEnd, FitCenter, FitStart, FitEnd: the picture kept to its shape, cropped or fitted), { Sliced: TextureSlicer } (nine-slice: border a number of px or { min_inset: [x, y], max_inset: [x, y] }; center_scale_mode and sides_scale_mode "Stretch" or { Tile: { stretch_value } }; max_corner_scale) or { Tiled: { tile_x, tile_y, stretch_value } }. Not with tileX or tileY |
| `sampler` | `SamplerSpec` | the picture's sampler (Bevy's load_with_settings: { filter, mipmap, wrap, anisotropy }), Bevy's default (linear) otherwise; { filter: "nearest" } is pixel art as Bevy's ImagePlugin::default_nearest() draws it |
| `children` | `ReactNode` | your own <Material> as its child: Bevy's SpriteMaterial, extending the sprite's own material (the shader reads the sprite's picture, tint and alpha with bevy_sprite_render::sprite_mesh::functions), its uniforms per frame |
| `name` | `string` | – |
| `x` | `number` | – |
| `y` | `number` | – |
| `name` | `string` | the entity's name, for picking, the inspector and world.* |
| `x` | `number` | px from the frame's left edge to the part's centre |
| `y` | `number` | px from the frame's top edge to the part's centre, down positive |
| `rotation` | `number` | radians, clockwise (as CSS rotate) |
| `quat` | `Quat` | Bevy's rotation as it is, a quaternion [x, y, z, w] in Bevy's axes (y up, z toward the viewer), in place of `rotation`: a turn out of the frame's plane too, as a Sprite's Transform takes it (camera/2d_on_ui) |
| `scale` | `number \| [number, number]` | 1 by default; [x, y] to stretch |
| `z` | `number` | draw order among the 2D parts: higher draws over lower (0 by default) |
| `opacity` | `number` | 0 to 1 (1 by default) |
| `onClick` | `(e: Event3d) => void` | – |
| `onPointerDown` | `(e: Event3d) => void` | – |
| `onPointerUp` | `(e: Event3d) => void` | – |
| `onPointerOver` | `(e: Event3d) => void` | – |
| `onPointerOut` | `(e: Event3d) => void` | – |
| `onPointerEnter` | `(e: Event3d) => void` | – |
| `onPointerLeave` | `(e: Event3d) => void` | – |
| `onPointerMove` | `(e: Event3d) => void` | – |
| `onWheel` | `(e: Event3d) => void` | – |
| `onDragStart` | `(e: Event3d) => void` | – |
| `onDrag` | `(e: Event3d) => void` | – |
| `onDragEnd` | `(e: Event3d) => void` | – |
| `onDragEnter` | `(e: Event3d) => void` | – |
| `onDragOver` | `(e: Event3d) => void` | – |
| `onDragLeave` | `(e: Event3d) => void` | – |
| `onDrop` | `(e: Event3d) => void` | – |
| `onClick` | `(e: Event3d) => void` | a press and release over the part |
| `onPointerDown` | `(e: Event3d) => void` | a button pressed over the part |
| `onPointerUp` | `(e: Event3d) => void` | a button released over the part |
| `onPointerOver` | `(e: Event3d) => void` | the pointer came over the part (bubbles, as the DOM's) |
| `onPointerOut` | `(e: Event3d) => void` | the pointer left the part (bubbles) |
| `onPointerEnter` | `(e: Event3d) => void` | the pointer came over the part (doesn't bubble) |
| `onPointerLeave` | `(e: Event3d) => void` | the pointer left the part (doesn't bubble) |
| `onPointerMove` | `(e: Event3d) => void` | the pointer moved over the part |
| `onWheel` | `(e: Event3d) => void` | the wheel turned over the part (`deltaX`, `deltaY`) |
| `onDragStart` | `(e: Event3d) => void` | a drag began on the part pressed |
| `onDrag` | `(e: Event3d) => void` | the part pressed is being dragged, each frame it moves |
| `onDragEnd` | `(e: Event3d) => void` | the drag of the part pressed ended |
| `onDragEnter` | `(e: Event3d) => void` | a dragged part came over this one (`dragged` names it) |
| `onDragOver` | `(e: Event3d) => void` | a dragged part is over this one |
| `onDragLeave` | `(e: Event3d) => void` | a dragged part left this one |
| `onDrop` | `(e: Event3d) => void` | a dragged part was dropped on this one |
### `VerticesProps`
| Field | Type | What it is |
| --- | --- | --- |
| `vertices` | `Vec2[]` | – |
| `vertex_colors` | `(LinearRgba \| [number, number, number, number])[]` | – |
| `ring` | `number` | – |
| `inner` | `Record<string, unknown>` | – |
| `vertices` | `Vec2[]` | the outline's points, in order |
| `vertex_colors` | `(LinearRgba \| [number, number, number, number])[]` | one linear colour a vertex, in the mesh's vertex order (ATTRIBUTE_COLOR) |
| `ring` | `number` | a thickness: the shape made a ring that thick (to_ring) |
| `inner` | `Record<string, unknown>` | the ring's inner shape, as the same shape's fields |
<!-- generated:end -->
+38 -38
View File
@@ -141,11 +141,11 @@ type Actions = Action<C, E> | readonly Action<C, E>[]
| Field | Type | What it is |
| --- | --- | --- |
| `id` (required) | `string` | – |
| `states` (required) | `{ name: N; parent: N \| null; depth: number; kind: "leaf" \| "compound" \| "final"; initia…` | – |
| `edges` (required) | `Edge<N>[]` | – |
| `id` (required) | `string` | the machine's id |
| `states` (required) | `{ name: N; parent: N \| null; depth: number; kind: "leaf" \| "compound" \| "final"; initia…` | every state with its parent, depth, kind and whether it's an initial state |
| `edges` (required) | `Edge<N>[]` | every transition |
| `reachable` (required) | `N[]` | states some sequence of transitions reaches from the initial state (guards assumed satisfiable) |
| `unreachable` (required) | `N[]` | – |
| `unreachable` (required) | `N[]` | states no sequence of transitions reaches |
| `deadEnds` (required) | `N[]` | non-final leaves with no transition out (their own or an enclosing state's): once entered, never left |
### `AnyMachine`
@@ -160,13 +160,13 @@ A choice point as a decider sees it: which machine, where, and the candidates wh
| Field | Type | What it is |
| --- | --- | --- |
| `machine` (required) | `string` | – |
| `machine` (required) | `string` | the machine's id |
| `state` (required) | `string` | the state whose `choose` list this is, and the active leaf |
| `leaf` (required) | `string` | – |
| `leaf` (required) | `string` | the active leaf state |
| `n` (required) | `number` | the machine's step |
| `candidates` (required) | `{ edge: number; to: string; description?: string }[]` | the candidates whose guards hold, in their order (each an edge of machine.edges) |
| `ctx` (required) | `C` | – |
| `env` (required) | `E` | – |
| `ctx` (required) | `C` | the context the machine drives |
| `env` (required) | `E` | whatever the step was given as env |
### `Decider`
@@ -175,8 +175,8 @@ is asked outside the step and their answer replayed (`replayDecider`). Determini
| Field | Type | What it is |
| --- | --- | --- |
| `name` (required) | `string` | – |
| `decide` (required) | `(point: ChoicePoint<unknown, unknown>) => Decision` | – |
| `name` (required) | `string` | its name in the trace's `by` column |
| `decide` (required) | `(point: ChoicePoint<unknown, unknown>) => Decision` | picks a candidate at a choice point, synchronously |
### `Decision`
@@ -185,21 +185,21 @@ whatever supports the choice (a bot's score, a model's probabilities), recorded
| Field | Type | What it is |
| --- | --- | --- |
| `edge` (required) | `number \| null` | – |
| `evidence` | `unknown` | – |
| `edge` (required) | `number \| null` | the edge picked, one of the candidates' `edge`; null waits this step |
| `evidence` | `unknown` | what supports the choice (a bot's score, a model's probabilities), recorded with the transition |
### `Edge`
| Field | Type | What it is |
| --- | --- | --- |
| `index` (required) | `number` | – |
| `from` (required) | `N` | – |
| `to` (required) | `N` | – |
| `kind` (required) | `"always" \| "after" \| "on" \| "done" \| "choose"` | – |
| `index` (required) | `number` | its place in `machine.edges` |
| `from` (required) | `N` | the state it leaves |
| `to` (required) | `N` | the state it enters |
| `kind` (required) | `"always" \| "after" \| "on" \| "done" \| "choose"` | what fires it: a guard polled each step (always), a delay (after), an event (on), the substate finishing (done) or a decider (choose) |
| `event` | `string` | the event an `on` edge waits for |
| `after` (required) | `number` | steps in `from` before it may fire |
| `guarded` (required) | `boolean` | – |
| `description` | `string` | – |
| `guarded` (required) | `boolean` | whether it has a guard (`when`) |
| `description` | `string` | what the transition means, from its config |
### `Guard`
@@ -213,8 +213,8 @@ type Guard = (ctx: C, env: E) => boolean
| Field | Type | What it is |
| --- | --- | --- |
| `id` (required) | `string` | – |
| `key` (required) | `K` | – |
| `id` (required) | `string` | the machine's name in traces and reports |
| `key` (required) | `K` | the context's field holding its snapshot ("sm") |
| `states` (required) | `readonly N[]` | every state, in definition order (outer before inner) |
| `edges` (required) | `readonly Edge<N>[]` | every transition, in the order they're checked within a state |
| `start` (required) | `() => Snapshot<N>` | a snapshot before the first step: the first step enters the initial states (running their entry actions) |
@@ -232,8 +232,8 @@ type Guard = (ctx: C, env: E) => boolean
| Field | Type | What it is |
| --- | --- | --- |
| `id` (required) | `string` | the machine's name in traces and reports |
| `initial` (required) | `NoInfer<N>` | – |
| `states` (required) | `{ [S in N]?: StateConfig<C, E, N> }` | – |
| `initial` (required) | `NoInfer<N>` | the state it starts in |
| `states` (required) | `{ [S in N]?: StateConfig<C, E, N> }` | its states by name, each a StateConfig (substates nest inside) |
| `key` | `K` | the context's field holding the snapshot ("sm") |
| `strict` | `boolean` | refuse unreachable states and non-final dead ends when the machine is built (true) |
@@ -264,12 +264,12 @@ guard); `hist` is each history state's last substate.
| Field | Type | What it is |
| --- | --- | --- |
| `path` (required) | `N[]` | – |
| `at` (required) | `number[]` | – |
| `n` (required) | `number` | – |
| `e` (required) | `number` | – |
| `by` | `string` | – |
| `hist` | `{ [S in N]?: N }` | – |
| `path` (required) | `N[]` | the active states, outermost first ([] before the first step) |
| `at` (required) | `number[]` | the step each state in `path` was entered on |
| `n` (required) | `number` | the machine's steps so far, from 0 |
| `e` (required) | `number` | the edge the last transition took, an index into `machine.edges` |
| `by` | `string` | the decider that chose the last transition (absent: a guard did) |
| `hist` | `{ [S in N]?: N }` | each history state's last substate |
### `StateConfig`
@@ -287,7 +287,7 @@ guard); `hist` is each history state's last substate.
| `history` | `"shallow" \| "deep"` | re-entering this compound state resumes the substate it left ("shallow"), or that substate's own (deep) |
| `onDone` | `Transitions<C, E, N>` | a compound state's transition taken when its active substate is final |
| `type` | `"final"` | a final state: no transitions out (a dead enemy, the game won, the work shipped) |
| `description` | `string` | – |
| `description` | `string` | what the state means, for reports and a decider |
### `StateName`
@@ -323,14 +323,14 @@ null for the first step's entry into the initial states.
| Field | Type | What it is |
| --- | --- | --- |
| `machine` (required) | `string` | – |
| `step` (required) | `number` | – |
| `from` (required) | `string \| null` | – |
| `to` (required) | `string` | – |
| `edge` (required) | `number` | – |
| `kind` (required) | `Edge["kind"] \| "start"` | – |
| `machine` (required) | `string` | the machine's id |
| `step` (required) | `number` | the machine's step it happened on |
| `from` (required) | `string \| null` | the leaf it left (null for the first entry) |
| `to` (required) | `string` | the leaf it entered |
| `edge` (required) | `number` | the edge it took, an index into `machine.edges` |
| `kind` (required) | `Edge["kind"] \| "start"` | what kind of edge: always, after, on, choose, done (an onDone), or start for the first entry |
| `by` (required) | `string` | "guard" for a trigger, "start" for the first entry, else the decider's name |
| `evidence` | `unknown` | – |
| `evidence` | `unknown` | the decider's evidence for the choice |
### `Transitions`
@@ -346,7 +346,7 @@ A machine's state in some context, for a trace (`Playtest.machines`).
| Field | Type | What it is |
| --- | --- | --- |
| `machine` (required) | `AnyMachine` | – |
| `snapshot` (required) | `Snapshot` | – |
| `machine` (required) | `AnyMachine` | the machine |
| `snapshot` (required) | `Snapshot` | its runtime state in that context |
<!-- generated:end -->
+31 -31
View File
@@ -105,11 +105,11 @@ What a glyph is, for a <RichText>'s `glyph` function.
| --- | --- | --- |
| `index` (required) | `number` | its place among the drawn glyphs (spaces aren't glyphs), from 0 |
| `count` (required) | `number` | how many glyphs the block has |
| `char` (required) | `string` | – |
| `char` (required) | `string` | the character it draws |
| `word` (required) | `number` | its word's place among the words, from 0, and how many there are |
| `words` (required) | `number` | – |
| `words` (required) | `number` | how many words the block has |
| `inWord` (required) | `number` | its place in its word, and the word's glyph count |
| `wordLength` (required) | `number` | – |
| `wordLength` (required) | `number` | how many glyphs its word has |
| `line` (required) | `number` | its line (by the newlines in the text), from 0 |
| `span` (required) | `number` | its run: the <Span> it's in (0 for text outside any, counted in order) |
@@ -122,10 +122,10 @@ multiplied into (scale, opacity) or replacing (color, visible) what the block's
| --- | --- | --- |
| `position` | `Vec3` | metres, from its place in the block |
| `rotation` | `Vec3` | radians, XYZ |
| `scale` | `number \| Vec3` | – |
| `color` | `string` | – |
| `opacity` | `number` | – |
| `visible` | `boolean` | – |
| `scale` | `number \| Vec3` | multiplies its size: one number, or x, y and z |
| `color` | `string` | replaces its colour |
| `opacity` | `number` | multiplies its opacity, 0..1 |
| `visible` | `boolean` | false hides it this frame |
### `RichTextProps`
@@ -133,57 +133,57 @@ multiplied into (scale, opacity) or replacing (color, visible) what the block's
| --- | --- | --- |
| `name` | `string` | what it's called across frames, and its glyphs' names over world.* (`${name}:${index}`) |
| `pass` | `string` | the composition pass it draws in ("scene" by default): a frame-wide effect told to skip a pass (<Look skip>, <Outline skip>, <Bloom skip>, <Grade skip>) leaves its pixels as drawn, and <Look passes> gives one its own paint; a piece names at most three passes besides "scene"; keyed per frame |
| `position` | `Vec3` | – |
| `rotation` | `Vec3` | – |
| `scale` | `number \| Vec3` | – |
| `position` | `Vec3` | where the block's origin is, metres (x, y, z) |
| `rotation` | `Vec3` | the block's rotation, radians (x, y, z) |
| `scale` | `number \| Vec3` | the block's scale: one number, or x, y and z |
| `size` | `number` | the em in metres (0.5 by default) |
| `font` | `string` | – |
| `weight` | `number` | – |
| `italic` | `boolean` | – |
| `font` | `string` | a family (raea's bundled faces: Inter by default, Montserrat, Oswald, Playfair Display...; or one on this machine) |
| `weight` | `number` | 100..900 (700 by default) |
| `italic` | `boolean` | slanted (false by default) |
| `color` | `string` | each glyph's colour unless its <Span> gives one |
| `align` | `"left" \| "center" \| "right"` | where the origin is: the left edge, the middle (default) or the right edge of the lines; the block's middle vertically |
| `lineHeight` | `number` | times the em (1.2 by default) |
| `maxWidth` | `number` | wrapped at this width in metres (no wrapping by default) |
| `roughness` | `number` | – |
| `metalness` | `number` | – |
| `emissive` | `string` | – |
| `emissiveIntensity` | `number` | – |
| `unlit` | `boolean` | – |
| `roughness` | `number` | 0..1, smooth to matte |
| `metalness` | `number` | 0..1, a dielectric to a metal |
| `emissive` | `string` | the colour it glows with |
| `emissiveIntensity` | `number` | how strongly it glows (1 by default; 2-10 with bloom) |
| `unlit` | `boolean` | drawn in its flat colour, without light or shade |
| `castShadow` | `boolean` | letter-shaped shadows (true by default) |
| `receiveShadow` | `boolean` | – |
| `layers` | `number[]` | – |
| `receiveShadow` | `boolean` | other things' shadows fall on it |
| `layers` | `number[]` | the render layers it's on ([0] by default): a camera draws only the layers it's given |
| `enter` | `MoveLike` | each glyph's (or word's) entrance: a move's name, a move or several (rise, pop, slam, slide, fade... the 2D ones, their px read at 100 an em, their degrees as degrees), `each` frames apart from `at` |
| `each` | `number` | frames between one glyph's (or word's) entrance and the next (2 by default) |
| `by` | `"letter" \| "word"` | the entrance and exit staggered by letter (default) or by word |
| `at` | `number` | – |
| `exit` | `MoveLike` | – |
| `exitAt` | `number` | – |
| `at` | `number` | the local frame the first entrance starts (0) |
| `exit` | `MoveLike` | each glyph's (or word's) exit: a move or its name, played backwards from `exitAt` |
| `exitAt` | `number` | the local frame the first exit starts; an exit needs it |
| `exitEach` | `number` | frames between exits (0: together) |
| `reveal` | `number` | how many glyphs are shown, a typewriter's count: the next one fades in over its fraction |
| `glyph` | `(g: GlyphInfo) => GlyphStyle` | each glyph's own motion this frame, from anything the frame gives (useCurrentFrame, spring, interpolate) |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | the text: strings and <Span> runs |
### `SpanProps`
| Field | Type | What it is |
| --- | --- | --- |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | the run's text |
| `font` | `string` | a family (raea's bundled faces: Inter, Montserrat, Oswald, Playfair Display...; or one on this machine) |
| `weight` | `number` | – |
| `italic` | `boolean` | – |
| `weight` | `number` | 100..900 (the block's by default) |
| `italic` | `boolean` | slanted (the block's by default) |
| `size` | `number` | times the block's size |
| `color` | `string` | – |
| `color` | `string` | the run's colour (the block's by default) |
### `Text3DProps`
| Field | Type | What it is |
| --- | --- | --- |
| `children` | `string` | the words, extruded |
| `text` | `string` | – |
| `text` | `string` | the words, when they aren't its child (no quotes or backslashes) |
| `size` | `number` | letter height in scene units (default 0.5) |
| `depth` | `number` | extrusion depth (default 0.2) |
| `font` | `string` | – |
| `weight` | `number` | – |
| `font` | `string` | a family (Inter by default, or another of raea's bundled faces) |
| `weight` | `number` | 100..900 (800 by default) |
### `WordOptions`
+23 -23
View File
@@ -38,17 +38,17 @@ own.
| Prop | Type | What it does |
| --- | --- | --- |
| `frame` (required) | `number` | – |
| `fps` (required) | `number` | – |
| `width` (required) | `number` | – |
| `height` (required) | `number` | – |
| `durationInFrames` (required) | `number` | – |
| `id` | `string` | – |
| `defaultProps` | `Record<string, unknown>` | – |
| `words` | `readonly TimelineWord[]` | – |
| `perception` | `Perception` | – |
| `input` | `InputTimeline` | – |
| `children` | `ReactNode` | – |
| `frame` (required) | `number` | the composition frame to draw |
| `fps` (required) | `number` | frames a second |
| `width` (required) | `number` | in px |
| `height` (required) | `number` | in px |
| `durationInFrames` (required) | `number` | the composition's length in frames |
| `id` | `string` | the composition's id ("main" by default) |
| `defaultProps` | `Record<string, unknown>` | the props the composition is rendered with |
| `words` | `readonly TimelineWord[]` | the transcript, in composition frames, that captions and word cuts read |
| `perception` | `Perception` | what perception saw at this frame (faces, the safe area) |
| `input` | `InputTimeline` | a game's recorded input by frame |
| `children` | `ReactNode` | the composition |
## Hooks
@@ -111,10 +111,10 @@ The local time a subtree sees: its own frame, and the composition frame its fram
| Field | Type | What it is |
| --- | --- | --- |
| `frame` (required) | `number` | – |
| `origin` (required) | `number` | – |
| `frame` (required) | `number` | the subtree's own frame: the composition's frame minus `origin` |
| `origin` (required) | `number` | the composition frame the subtree's frame 0 falls on |
| `width` (required) | `number` | width and height a Sequence overrides for its children |
| `height` (required) | `number` | – |
| `height` (required) | `number` | in px, what the Sequence gives its children |
### `Perception`
@@ -122,14 +122,14 @@ What perception saw at this frame: the largest face, and the platform's safe are
| Field | Type | What it is |
| --- | --- | --- |
| `face` | `Rect` | – |
| `safe` | `{ top?: number; bottom?: number }` | – |
| `face` | `Rect` | the largest face's box, when there's one |
| `safe` | `{ top?: number; bottom?: number }` | px the platform's UI covers at the top and bottom |
### `TimelineWord`
| Field | Type | What it is |
| --- | --- | --- |
| `text` (required) | `string` | – |
| `text` (required) | `string` | the word as spoken |
| `from` (required) | `number` | first frame of the word |
| `to` (required) | `number` | frame after the word ends (exclusive) |
@@ -137,11 +137,11 @@ What perception saw at this frame: the largest face, and the platform's safe are
| Field | Type | What it is |
| --- | --- | --- |
| `id` (required) | `string` | – |
| `width` (required) | `number` | – |
| `height` (required) | `number` | – |
| `fps` (required) | `number` | – |
| `durationInFrames` (required) | `number` | – |
| `defaultProps` (required) | `Record<string, unknown>` | – |
| `id` (required) | `string` | the composition's id ("main" by default) |
| `width` (required) | `number` | in px |
| `height` (required) | `number` | in px |
| `fps` (required) | `number` | frames a second |
| `durationInFrames` (required) | `number` | its length in frames |
| `defaultProps` (required) | `Record<string, unknown>` | the props the composition is rendered with |
<!-- generated:end -->
+12 -12
View File
@@ -54,14 +54,14 @@ function surfaceTurn(normal: Vec3, spin?: number): [number, number, number, numb
A rotation as glam's Quat: [x, y, z, w].
glam's Quat constructors, by their Rust names in camelCase.
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [3d/3d_shapes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/3d_shapes.tsx), [3d/texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/texture.tsx), [3d/shadow_caster_receiver](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/shadow_caster_receiver.tsx), [3d/split_screen](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/split_screen.tsx), [3d/spotlight](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spotlight.tsx), [3d/mesh_ray_cast](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/mesh_ray_cast.tsx), [3d/3d_scene](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/3d_scene.tsx), and 24 more.
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [3d/3d_shapes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/3d_shapes.tsx), [3d/texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/texture.tsx), [3d/shadow_caster_receiver](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/shadow_caster_receiver.tsx), [3d/split_screen](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/split_screen.tsx), [3d/spotlight](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spotlight.tsx), [3d/mesh_ray_cast](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/mesh_ray_cast.tsx), [3d/3d_scene](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/3d_scene.tsx), and 23 more.
### `Transform`
Bevy's Transform: the component's handle for a program (`with(Transform, Transform.fromXyz(1, 0, 0))`) and its
builders for a scene (`<Mesh3d transform={Transform.fromXyz(0, 1, 0)}>`).
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/widgets/viewport_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/viewport_node.tsx), [3d/fog_volumes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog_volumes.tsx), [3d/fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog.tsx), [3d/vertex_colors](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/vertex_colors.tsx), [3d/rotate_environment_map](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/rotate_environment_map.tsx), [3d/transparency_3d](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx), [3d/spherical_area_lights](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spherical_area_lights.tsx), and 72 more.
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/widgets/viewport_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/viewport_node.tsx), [3d/fog_volumes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog_volumes.tsx), [3d/fog](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog.tsx), [3d/vertex_colors](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/vertex_colors.tsx), [3d/rotate_environment_map](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/rotate_environment_map.tsx), [3d/transparency_3d](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx), [3d/spherical_area_lights](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/spherical_area_lights.tsx), and 71 more.
## Types
@@ -79,13 +79,13 @@ A Transform built with Bevy's builders: each returns a new one.
| Field | Type | What it is |
| --- | --- | --- |
| `withTranslation` (required) | `(v: Vec3) => TransformBuilt` | – |
| `withRotation` (required) | `(q: Quat) => TransformBuilt` | – |
| `withScale` (required) | `(s: number \| Vec3) => TransformBuilt` | – |
| `lookingAt` (required) | `(target: Vec3, up?: Vec3 \| undefined) => TransformBuilt` | – |
| `translation` (required) | `Vec3` | – |
| `rotation` (required) | `Quat` | – |
| `scale` (required) | `Vec3` | – |
| `withTranslation` (required) | `(v: Vec3) => TransformBuilt` | the same transform, moved to `v` |
| `withRotation` (required) | `(q: Quat) => TransformBuilt` | the same transform, turned to `q` |
| `withScale` (required) | `(s: number \| Vec3) => TransformBuilt` | the same transform, scaled to `s` (one number for all three axes) |
| `lookingAt` (required) | `(target: Vec3, up?: Vec3 \| undefined) => TransformBuilt` | the same transform, turned so its -Z faces `target` with `up` (+Y) up, as Bevy's looking_at |
| `translation` (required) | `Vec3` | where it is, metres (x, y, z) |
| `rotation` (required) | `Quat` | its rotation as a quaternion [x, y, z, w] |
| `scale` (required) | `Vec3` | its scale along x, y and z |
### `TransformValue`
@@ -93,9 +93,9 @@ A Transform's value, as Bevy reflects it.
| Field | Type | What it is |
| --- | --- | --- |
| `translation` | `Vec3` | – |
| `rotation` | `Quat` | – |
| `scale` | `Vec3` | – |
| `translation` | `Vec3` | where it is, metres (x, y, z) |
| `rotation` | `Quat` | its rotation as a quaternion [x, y, z, w] |
| `scale` | `Vec3` | its scale along x, y and z |
### `Vec3`
+54 -64
View File
@@ -39,9 +39,9 @@ A box over the whole of its parent, laid out as a flex column; `style` is merged
| Prop | Type | What it does |
| --- | --- | --- |
| `style` | `CSSProperties` | – |
| `className` | `string` | – |
| `children` | `ReactNode` | – |
| `style` | `CSSProperties` | merged over the fill's own style (absolute, inset 0, a flex column) |
| `className` | `string` | Tailwind or CSS classes |
| `children` | `ReactNode` | what fills it |
### `BoxShadowSamples`
@@ -52,8 +52,8 @@ Bevy: `bevy_ui_render::BoxShadowSamples`.
| Prop | Type | What it does |
| --- | --- | --- |
| `samples` (required) | `number` | – |
| `children` | `ReactNode` | – |
| `samples` (required) | `number` | steps each shadow's blur is summed in (4) |
| `children` | `ReactNode` | the UI it applies to |
Used in: [ui/styling/box_shadow](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/styling/box_shadow.tsx).
@@ -77,7 +77,7 @@ Bevy: `bevy_text::EditableText`.
| `cursor_style` | `TextCursorStyle` | TextCursorStyle |
| `auto_focus` | `boolean` | AutoFocus: it has the input focus, so its caret is drawn |
| `justify` | `TextProps["justify"]` | TextLayout's justify and linebreak |
| `linebreak` | `TextProps["linebreak"]` | – |
| `linebreak` | `TextProps["linebreak"]` | where lines break: WordBoundary, AnyCharacter, WordOrCharacter or NoWrap |
Also takes the props of [`NodeProps`](#nodeprops); `PickProps` (`popover`, `onClick`, `onPointerDown`, `onPointerUp`, `onPointerOver`, `onPointerOut`, `onPointerEnter`, `onPointerLeave`, `onPointerMove`); [`TextStyleProps`](#textstyleprops).
@@ -92,7 +92,7 @@ Bevy: `bevy_ui::experimental::GhostNode`.
| Prop | Type | What it does |
| --- | --- | --- |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | what's laid out as the parent's children |
Used in: [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx).
@@ -105,7 +105,7 @@ Bevy: `bevy_ui_render::GlobalUiDebugOptions`.
| Prop | Type | What it does |
| --- | --- | --- |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | the UI the overlay draws over |
Also takes the props of [`UiDebugOptions`](#uidebugoptions).
@@ -141,8 +141,8 @@ Bevy: `bevy_image::ImagePlugin`.
| Prop | Type | What it does |
| --- | --- | --- |
| `default_sampler` | `"Linear" \| "Nearest"` | Bevy: The default image sampler to use when `ImageSampler` is set to `Default`. |
| `children` | `ReactNode` | – |
| `default_sampler` | `"Linear" \| "Nearest"` | "Linear" (the default) or "Nearest" (pixel art) |
| `children` | `ReactNode` | the UI and sprites whose pictures it samples |
Used in: [ui/images/ui_texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx).
@@ -175,7 +175,7 @@ Bevy: `bevy_ui_render::ui_material::MaterialNode`.
| `uniforms` | `Record<string, Uniform \| Record<string, Uniform>>` | each `var<uniform>` the shader declares, by name: a number, [x, y], [x, y, z], [x, y, z, w] (a LinearRgba's to_f32_array()) or "#rrggbb"; a struct's as {field: value} |
| `textures` | `Record<string, string>` | each `texture_2d<f32>` it declares, by name: a picture file (staticFile), sampled with Bevy's default sampler |
| `defs` | `Record<string, boolean \| number>` | shader defs, as a Material's |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | the nodes inside it |
Also takes the props of [`NodeProps`](#nodeprops); `PickProps` (`popover`, `onClick`, `onPointerDown`, `onPointerUp`, `onPointerOver`, `onPointerOut`, `onPointerEnter`, `onPointerLeave`, `onPointerMove`).
@@ -198,11 +198,11 @@ A box at the band its name stands for, clear of the face perception found at thi
| Prop | Type | What it does |
| --- | --- | --- |
| `name` | `RegionName` | – |
| `margin` | `number` | – |
| `style` | `CSSProperties` | – |
| `className` | `string` | – |
| `children` | `ReactNode` | – |
| `name` | `RegionName` | the band: "auto" (default) takes the larger of top and bottom; top and bottom stay clear of the face; center is the middle third; full is the safe area |
| `margin` | `number` | the gap kept from the face and the sides, as a share of the width (0.06) |
| `style` | `CSSProperties` | merged under the box's own placement |
| `className` | `string` | Tailwind or CSS classes |
| `children` | `ReactNode` | what goes in the band; `useRegion()` reads its box |
### `Scrollbar`
@@ -263,7 +263,7 @@ Bevy: `bevy_sprite::text2d::Text2d`.
| `anchor` | `[number, number]` | Bevy's Anchor, as its Vec2: which point of the block sits at its Transform, [-0.5, -0.5] its bottom left to [0.5, 0.5] its top right ([0, 0], the centre, by default; Anchor::TOP_CENTER is [0, 0.5]) |
| `bounds` | `[number \| null, number \| null]` | TextBounds: the box its lines wrap in, [width, height] px (either null, unbounded), the anchor then the box's point; inside a Canvas3D |
| `shadow` | `Text2dShadow \| true` | Text2dShadow (true for its default); inside a Canvas3D |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | the text, and TextSpan runs |
Also takes the props of [`TextStyleProps`](#textstyleprops); [`TextRunProps`](#textrunprops) (`underline`, `strikethrough`, `underline_color`, `strikethrough_color`, `text_background_color`).
@@ -277,7 +277,7 @@ Bevy: `bevy_text::text::TextSpan`.
| Prop | Type | What it does |
| --- | --- | --- |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | the run's text |
Also takes the props of [`TextStyleProps`](#textstyleprops); [`TextRunProps`](#textrunprops) (`underline`, `strikethrough`, `underline_color`, `strikethrough_color`, `text_background_color`).
@@ -293,8 +293,8 @@ Bevy: `bevy_ui::UiScale`.
| Prop | Type | What it does |
| --- | --- | --- |
| `value` (required) | `number` | – |
| `children` | `ReactNode` | – |
| `value` (required) | `number` | how many times as big the UI is drawn (UiScale) |
| `children` | `ReactNode` | the UI it scales |
Used in: [ui/images/ui_texture_slice_flip_and_tile](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice_flip_and_tile.tsx), [ui/scroll_and_overflow/scrollbars](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/scrollbars.tsx), [ui/scroll_and_overflow/drag_to_scroll](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/drag_to_scroll.tsx).
@@ -310,8 +310,8 @@ Bevy: `bevy_ui::UiTargetCamera`.
| Prop | Type | What it does |
| --- | --- | --- |
| `order` | `number` | – |
| `children` | `ReactNode` | – |
| `order` | `number` | the camera, by its order, these roots draw with (0) |
| `children` | `ReactNode` | the UI roots that camera draws |
Used in: [ui/ui_target_camera](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/ui_target_camera.tsx), [3d/split_screen](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/split_screen.tsx).
@@ -325,8 +325,8 @@ Bevy: `bevy_camera::RenderTarget::Image`.
| Prop | Type | What it does |
| --- | --- | --- |
| `target` (required) | `string` | – |
| `children` | `ReactNode` | – |
| `target` (required) | `string` | the image's name, as a material or ImageNode uses it |
| `children` | `ReactNode` | the UI roots drawn into it |
Used in: [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx).
@@ -340,9 +340,9 @@ Bevy: `bevy_camera::Viewport`.
| Prop | Type | What it does |
| --- | --- | --- |
| `physical_position` (required) | `[number, number]` | Bevy: The physical position to render this viewport to within the `RenderTarget` of this `Camera`. (0,0) corresponds to the top-left corner |
| `physical_size` (required) | `[number, number]` | Bevy: The physical size of the viewport rectangle to render to within the `RenderTarget` of this `Camera`. The origin of the rectangle is in the top-left corner. |
| `children` | `ReactNode` | – |
| `physical_position` (required) | `[number, number]` | the region's top-left corner, px from the window's |
| `physical_size` (required) | `[number, number]` | the region's width and height, px |
| `children` | `ReactNode` | the cameras and UI drawn into the region |
Used in: [ui/relative_cursor_position](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/relative_cursor_position.tsx), [3d/split_screen](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/split_screen.tsx).
@@ -492,8 +492,6 @@ Used in: [ui/text/text_input](https://github.com/shinyobjectz/raea/blob/main/sdk
Bevy's BorderRadius: a Val (circular) or a CornerRadius (elliptical) for each corner (0 by default).
Bevy: `bevy_ui::BorderRadius`.
Used in: [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), [ui/navigation/directional_navigation_overrides](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/navigation/directional_navigation_overrides.tsx), [ui/navigation/directional_navigation](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/navigation/directional_navigation.tsx), [ui/scroll_and_overflow/scrollbars](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/scrollbars.tsx), [ui/scroll_and_overflow/overflow_transform](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow_transform.tsx), [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/ui_material](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/ui_material.tsx), [ui/styling/gradients](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/styling/gradients.tsx), and 7 more.
### `BoxShadow`
@@ -525,8 +523,6 @@ Used in: [ui/styling/stacked_gradients](https://github.com/shinyobjectz/raea/blo
Bevy's CornerRadius: a corner's x and y radii, an elliptical corner (a Val alone is a circular one).
Bevy: `bevy_ui::CornerRadius`.
Used in: [ui/styling/borders](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/styling/borders.tsx).
### `FEED_KEY`
@@ -620,16 +616,12 @@ Used in: [ui/styling/stacked_gradients](https://github.com/shinyobjectz/raea/blo
Bevy's Overflow: each axis Visible, Clip, Hidden or Scroll.
Bevy: `bevy_ui::Overflow`.
Used in: [ui/scroll_and_overflow/overflow](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow.tsx), [ui/scroll_and_overflow/scrollbars](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/scrollbars.tsx), [ui/scroll_and_overflow/drag_to_scroll](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/drag_to_scroll.tsx), [ui/scroll_and_overflow/scroll](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/scroll.tsx), [ui/scroll_and_overflow/overflow_clip_margin](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow_clip_margin.tsx), [ui/text/multiple_text_inputs](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/multiple_text_inputs.tsx), [ui/text/text_wrap_debug](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/text_wrap_debug.tsx), [ui/widgets/headless_tabs](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/widgets/headless_tabs.tsx).
### `OverflowClipMargin`
Bevy's OverflowClipMargin: the box an overflow clip clips to, grown by a margin in px (the padding box by default).
Bevy: `bevy_ui::OverflowClipMargin`.
Used in: [ui/scroll_and_overflow/overflow_clip_margin](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow_clip_margin.tsx), [ui/text/multiple_text_inputs](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/multiple_text_inputs.tsx).
### `RadialGradient`
@@ -691,8 +683,6 @@ Used in: [ui/styling/stacked_gradients](https://github.com/shinyobjectz/raea/blo
Bevy's UiRect: a Val for each side (0 by default).
Bevy: `bevy_ui::UiRect`.
Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx), [ui/images/image_node_resizing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node_resizing.tsx), [ui/images/ui_texture_atlas_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas_slice.tsx), [ui/images/ui_texture_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice.tsx), [ui/layout/grid](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/grid.tsx), [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), [ui/layout/flex_layout](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/flex_layout.tsx), [ui/layout/size_constraints](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/size_constraints.tsx), and 43 more.
### `UiTransform`
@@ -740,8 +730,8 @@ Bevy: `bevy_text::FontAtlas`.
| Field | Type | What it is |
| --- | --- | --- |
| `texture` (required) | `string` | Bevy: The texture where this font atlas is located |
| `width` (required) | `number` | – |
| `height` (required) | `number` | – |
| `width` (required) | `number` | the texture's width in px |
| `height` (required) | `number` | the texture's height in px |
### `GenericFontFamily`
@@ -791,8 +781,8 @@ Bevy: `bevy_ui::IgnoreScroll`.
| Field | Type | What it is |
| --- | --- | --- |
| `x` (required) | `boolean` | – |
| `y` (required) | `boolean` | – |
| `x` (required) | `boolean` | it keeps its place while the parent scrolls across |
| `y` (required) | `boolean` | it keeps its place while the parent scrolls down |
### `ImageNodeProps`
@@ -846,9 +836,9 @@ panel's state.
| Field | Type | What it is |
| --- | --- | --- |
| `about` (required) | `string` | – |
| `args` | `Record<string, string>` | – |
| `run` (required) | `(state: S, args: A) => S` | – |
| `about` (required) | `string` | what the action does, for the agent |
| `args` | `Record<string, string>` | its arguments by name, a few words each |
| `run` (required) | `(state: S, args: A) => S` | the panel's state after it |
### `PanelActions`
@@ -884,21 +874,21 @@ Bevy: `bevy_ui_widgets::popover::PopoverPlacement`.
| Field | Type | What it is |
| --- | --- | --- |
| `width` (required) | `number` | – |
| `height` (required) | `number` | – |
| `face` | `Rect` | – |
| `parts` (required) | `ProofPart[]` | – |
| `width` (required) | `number` | the composition's width, px |
| `height` (required) | `number` | the composition's height, px |
| `face` | `Rect` | the face's box, when perception found one |
| `parts` (required) | `ProofPart[]` | the measured boxes of the parts to check |
### `ProofPart`
| Field | Type | What it is |
| --- | --- | --- |
| `name` (required) | `string` | – |
| `name` (required) | `string` | the part's name, in the faults |
| `band` | `[number, number]` | the band the part must fit in, [top, bottom] in px |
| `x` (required) | `number` | – |
| `y` (required) | `number` | – |
| `w` (required) | `number` | – |
| `h` (required) | `number` | – |
| `x` (required) | `number` | the left edge, px |
| `y` (required) | `number` | the top edge, px |
| `w` (required) | `number` | width, px |
| `h` (required) | `number` | height, px |
### `RadialGradientShape`
@@ -918,11 +908,11 @@ The band a Region occupies, in composition px.
| Field | Type | What it is |
| --- | --- | --- |
| `name` (required) | `RegionName` | – |
| `x` (required) | `number` | – |
| `y` (required) | `number` | – |
| `w` (required) | `number` | – |
| `h` (required) | `number` | – |
| `name` (required) | `RegionName` | the band it took: top, bottom, center or full ("auto" resolves to top or bottom) |
| `x` (required) | `number` | the left edge, px |
| `y` (required) | `number` | the top edge, px |
| `w` (required) | `number` | width, px |
| `h` (required) | `number` | height, px |
### `RegionName`
@@ -991,9 +981,9 @@ What bevy_text draws with a section's own glyphs (a Text's string, not its spans
| Field | Type | What it is |
| --- | --- | --- |
| `underline` | `boolean` | Underline and Strikethrough: a line under or through the run, as thick as the font says |
| `strikethrough` | `boolean` | – |
| `strikethrough` | `boolean` | a line through the run |
| `underline_color` | `Color` | UnderlineColor and StrikethroughColor: the lines' colours (the text's colour by default) |
| `strikethrough_color` | `Color` | – |
| `strikethrough_color` | `Color` | the strikethrough's colour (the text's by default) |
| `text_background_color` | `Color` | TextBackgroundColor: a box behind the run, line by line |
### `TextStyleProps`
@@ -1023,10 +1013,10 @@ default), and the corners' most scale (1 by default)
| Field | Type | What it is |
| --- | --- | --- |
| `border` (required) | `{ left: number; right: number; top: number; bottom: number }` | – |
| `center_scale_mode` | `SliceScaleMode` | – |
| `sides_scale_mode` | `SliceScaleMode` | – |
| `max_corner_scale` | `number` | – |
| `border` (required) | `{ left: number; right: number; top: number; bottom: number }` | the slices' insets, in the picture's px |
| `center_scale_mode` | `SliceScaleMode` | how the centre scales (Stretch) |
| `sides_scale_mode` | `SliceScaleMode` | how the sides scale (Stretch) |
| `max_corner_scale` | `number` | how much the corners may scale at most (1) |
### `UiDebugOptions`
+38 -38
View File
@@ -44,8 +44,8 @@ Shows its children as they are at `frame`, whatever the parent's frame.
| Prop | Type | What it does |
| --- | --- | --- |
| `frame` (required) | `number` | – |
| `children` | `ReactNode` | – |
| `frame` (required) | `number` | the frame its children see, whatever the parent's frame |
| `children` | `ReactNode` | what's held |
### `Loop`
@@ -53,13 +53,13 @@ Repeats its children every `durationInFrames` frames, `times` times (forever by
| Prop | Type | What it does |
| --- | --- | --- |
| `durationInFrames` (required) | `number` | – |
| `times` | `number` | – |
| `name` | `string` | – |
| `layout` | `SequenceLayout` | – |
| `style` | `CSSProperties` | – |
| `className` | `string` | – |
| `children` | `ReactNode` | – |
| `durationInFrames` (required) | `number` | the length of one loop, in frames |
| `times` | `number` | how many times it plays (forever by default) |
| `name` | `string` | its label in the timeline and the render manifest |
| `layout` | `SequenceLayout` | "absolute-fill" (default) or "none", as a Sequence's |
| `style` | `CSSProperties` | the wrapping box's style |
| `className` | `string` | the wrapping box's classes |
| `children` | `ReactNode` | what loops |
### `Sequence`
@@ -67,15 +67,15 @@ Shifts time by `from` and shows its children only for `durationInFrames` frames.
| Prop | Type | What it does |
| --- | --- | --- |
| `from` | `number` | – |
| `durationInFrames` | `number` | – |
| `name` | `string` | – |
| `layout` | `SequenceLayout` | – |
| `width` | `number` | – |
| `height` | `number` | – |
| `style` | `CSSProperties` | – |
| `className` | `string` | – |
| `children` | `ReactNode` | – |
| `from` | `number` | the parent frame its frame 0 falls on (0) |
| `durationInFrames` | `number` | how many frames it shows its children (forever by default) |
| `name` | `string` | its label in the timeline and the render manifest (`data-sequence`) |
| `layout` | `SequenceLayout` | "absolute-fill" (default) wraps the children in a full-size box; "none" adds no box |
| `width` | `number` | the width its children see, px (the parent's by default) |
| `height` | `number` | the height its children see, px (the parent's by default) |
| `style` | `CSSProperties` | the wrapping box's style |
| `className` | `string` | the wrapping box's classes |
| `children` | `ReactNode` | what plays in it, at its own local time |
### `Series`
@@ -83,7 +83,7 @@ Plays its Series.Sequence children back to back, each shifted by its own offset.
| Prop | Type | What it does |
| --- | --- | --- |
| `children` | `ReactNode` | – |
| `children` | `ReactNode` | the Series.Sequence slots, played back to back |
### `Video`
@@ -110,22 +110,22 @@ The props of [`Loop`](#loop), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `src` (required) | `string` | – |
| `startFrom` | `number` | – |
| `endAt` | `number` | – |
| `trimBefore` | `number` | – |
| `trimAfter` | `number` | – |
| `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) |
| `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) |
| `fadeOut` | `number` | ours: seconds to ramp the sound out to silence at its end |
| `playbackRate` | `number` | – |
| `muted` | `boolean` | – |
| `loop` | `boolean` | – |
| `playbackRate` | `number` | how fast it plays (1): 2 is double speed |
| `muted` | `boolean` | play no sound |
| `loop` | `boolean` | start again from `startFrom` when it reaches `endAt` |
| `bus` | `string` | the bus it plays into: a named channel of the edit's Tone graph (music, sfx, voice, ambience, ui), so it takes that bus's volume, effects and ducking (raea/tone `buses`) |
| `name` | `string` | – |
| `className` | `string` | – |
| `style` | `CSSProperties` | – |
| `name` | `string` | the entity's name, for picking, the inspector and world.* |
| `className` | `string` | Tailwind or CSS classes |
| `style` | `CSSProperties` | inline style |
### `SequenceLayout`
@@ -141,14 +141,14 @@ The props of [`Sequence`](#sequence), tabled there.
| Field | Type | What it is |
| --- | --- | --- |
| `offset` | `number` | – |
| `height` | `number` | – |
| `style` | `CSSProperties` | – |
| `children` | `ReactNode` | – |
| `className` | `string` | – |
| `name` | `string` | – |
| `width` | `number` | – |
| `durationInFrames` | `number` | – |
| `offset` | `number` | frames from the previous slot's end to this one's start (0); negative overlaps |
| `height` | `number` | the height its children see, px (the parent's by default) |
| `style` | `CSSProperties` | the wrapping box's style |
| `children` | `ReactNode` | what plays in it, at its own local time |
| `className` | `string` | the wrapping box's classes |
| `name` | `string` | its label in the timeline and the render manifest (`data-sequence`) |
| `width` | `number` | the width its children see, px (the parent's by default) |
| `durationInFrames` | `number` | how many frames it shows its children (forever by default) |
### `VideoProps`
+5 -1
View File
@@ -11,7 +11,7 @@ const call: Call = (name, args) => (native as unknown as (n: string, a: unknown)
export class BevyApp {
/** the methods this App answers (BRP's, raea's and its plugins') */
readonly methods: string[];
private constructor(readonly id: number, methods: string[]) {
private constructor(/** the App's handle in the engine */ readonly id: number, methods: string[]) {
this.methods = methods;
}
@@ -251,6 +251,7 @@ export class BevyApp {
return r.entity;
}
/** Adds these components to an entity, replacing any it has of the same type. */
insert(entity: Entity, ...components: With[]): void {
this.call("world.insert_components", { entity, components: Object.fromEntries(components.map((c) => [c.path, c.value])) });
}
@@ -270,10 +271,12 @@ export class BevyApp {
});
}
/** A resource's value. */
resource<T>(r: Resource<T>): T {
return this.call<{ value: T }>("world.get_resources", { resource: r.path }).value;
}
/** Sets a resource's value, adding it if the app hasn't got one. */
setResource<T>(r: Resource<T>, value: T): void {
this.call("world.insert_resources", { resource: r.path, value });
}
@@ -335,6 +338,7 @@ export class BevyApp {
return this.call("registry.schema", crates ? { with_crates: crates } : undefined);
}
/** Shuts the app down; its methods fail after. */
close(): void {
call("bevy.app.close", { app: this.id });
}
+11 -1
View File
@@ -63,10 +63,15 @@ export { with_ as with };
* states to the App; once every plugin is built, each one's `finish` runs, then each one's `cleanup`, as App::run
* does. Unique by `name` unless `isUnique` is false (Bevy panics on a unique plugin added twice; this throws). */
export interface Plugin {
/** the plugin's name: two unique plugins of one name can't both be added */
name: string;
/** adds the plugin's systems, resources and other plugins to the app */
build(app: BevyApp): void;
/** called once every plugin is built, for setup that needs the others */
finish?(app: BevyApp): void;
/** called after every plugin's finish */
cleanup?(app: BevyApp): void;
/** whether adding it twice is an error (true) */
isUnique?: boolean;
}
@@ -82,25 +87,30 @@ export type PluginRef = string | { readonly plugin: string } | Plugin | PluginGr
* leaves one out, and the App adds the rest in order. */
export class PluginGroup {
private readonly members: { key: string; plugin: string | Plugin; on: boolean }[];
constructor(readonly name: string, plugins: (string | { readonly plugin: string } | Plugin)[]) {
/** A group named `name` of these plugins, in the order the App adds them. */
constructor(/** the group's name */ readonly name: string, plugins: (string | { readonly plugin: string } | Plugin)[]) {
this.members = plugins.map((p) => {
const plugin = rustName(p) ?? (p as Plugin);
return { key: typeof plugin === "string" ? plugin : plugin.name, plugin, on: true };
});
}
/** Replaces the member of `p`'s name with `p`. */
set(p: Plugin): PluginGroup {
const m = this.member(p.name);
m.plugin = p;
return this;
}
/** Leaves the member of this name out. */
disable(name: string): PluginGroup {
this.member(name).on = false;
return this;
}
/** Puts a disabled member back. */
enable(name: string): PluginGroup {
this.member(name).on = true;
return this;
}
/** The plugins to add, in order, without the disabled ones. */
build(): (string | Plugin)[] {
return this.members.filter((m) => m.on).map((m) => m.plugin);
}
+27
View File
@@ -3,6 +3,7 @@
import { createContext, useContext, useLayoutEffect, useReducer, useRef, version, type ReactNode } from "react";
export interface TimelineWord {
/** the word as spoken */
text: string;
/** first frame of the word */
from: number;
@@ -11,25 +12,37 @@ export interface TimelineWord {
}
export interface VideoConfig {
/** the composition's id ("main" by default) */
id: string;
/** in px */
width: number;
/** in px */
height: number;
/** frames a second */
fps: number;
/** its length in frames */
durationInFrames: number;
/** the props the composition is rendered with */
defaultProps: Record<string, unknown>;
}
/** A box in composition px. */
export interface Rect {
/** the left edge, px */
x: number;
/** the top edge, px */
y: number;
/** width, px */
w: number;
/** height, px */
h: number;
}
/** What perception saw at this frame: the largest face, and the platform's safe area (composition px). */
export interface Perception {
/** the largest face's box, when there's one */
face?: Rect;
/** px the platform's UI covers at the top and bottom */
safe?: { top?: number; bottom?: number };
}
@@ -66,10 +79,13 @@ export interface ClockState {
/** The local time a subtree sees: its own frame, and the composition frame its frame 0 falls on. */
export interface LocalTime {
/** the subtree's own frame: the composition's frame minus `origin` */
frame: number;
/** the composition frame the subtree's frame 0 falls on */
origin: number;
/** width and height a Sequence overrides for its children */
width: number;
/** in px, what the Sequence gives its children */
height: number;
}
@@ -203,16 +219,27 @@ export function useVideoConfig(): VideoConfig {
}
export interface ClockProps {
/** the composition frame to draw */
frame: number;
/** frames a second */
fps: number;
/** in px */
width: number;
/** in px */
height: number;
/** the composition's length in frames */
durationInFrames: number;
/** the composition's id ("main" by default) */
id?: string;
/** the props the composition is rendered with */
defaultProps?: Record<string, unknown>;
/** the transcript, in composition frames, that captions and word cuts read */
words?: readonly TimelineWord[];
/** what perception saw at this frame (faces, the safe area) */
perception?: Perception;
/** a game's recorded input by frame */
input?: InputTimeline;
/** the composition */
children?: ReactNode;
}
+12
View File
@@ -4,15 +4,21 @@ import { Action, Actions, Guard, MachineConfig, Snapshot, StateConfig, StepOptio
// ---- the compiled machine ------------------------------------------------------------------------------------------
export interface Edge<N extends string = string> {
/** its place in `machine.edges` */
index: number;
/** the state it leaves */
from: N;
/** the state it enters */
to: N;
/** what fires it: a guard polled each step (always), a delay (after), an event (on), the substate finishing (done) or a decider (choose) */
kind: "always" | "after" | "on" | "done" | "choose";
/** the event an `on` edge waits for */
event?: string;
/** steps in `from` before it may fire */
after: number;
/** whether it has a guard (`when`) */
guarded: boolean;
/** what the transition means, from its config */
description?: string;
}
@@ -41,18 +47,24 @@ interface Node<C, E> {
}
export interface Analysis<N extends string = string> {
/** the machine's id */
id: string;
/** every state with its parent, depth, kind and whether it's an initial state */
states: { name: N; parent: N | null; depth: number; kind: "leaf" | "compound" | "final"; initial: boolean }[];
/** every transition */
edges: Edge<N>[];
/** states some sequence of transitions reaches from the initial state (guards assumed satisfiable) */
reachable: N[];
/** states no sequence of transitions reaches */
unreachable: N[];
/** non-final leaves with no transition out (their own or an enclosing state's): once entered, never left */
deadEnds: N[];
}
export interface Machine<C, E, N extends string, K extends string = "sm"> {
/** the machine's name in traces and reports */
readonly id: string;
/** the context's field holding its snapshot ("sm") */
readonly key: K;
/** every state, in definition order (outer before inner) */
readonly states: readonly N[];
+26
View File
@@ -75,13 +75,16 @@ export interface StateConfig<C, E, N extends string> {
onDone?: Transitions<C, E, N>;
/** a final state: no transitions out (a dead enemy, the game won, the work shipped) */
type?: "final";
/** what the state means, for reports and a decider */
description?: string;
}
export interface MachineConfig<C, E, N extends string, K extends string> {
/** the machine's name in traces and reports */
id: string;
/** the state it starts in */
initial: NoInfer<N>;
/** its states by name, each a StateConfig (substates nest inside) */
states: { [S in N]?: StateConfig<C, E, N> };
/** the context's field holding the snapshot ("sm") */
key?: K;
@@ -96,17 +99,25 @@ export interface MachineConfig<C, E, N extends string, K extends string> {
* edge the last transition took (an index into machine.edges); `by` names the decider that chose it (absent: a
* guard); `hist` is each history state's last substate. */
export interface Snapshot<N extends string = string> {
/** the active states, outermost first ([] before the first step) */
path: N[];
/** the step each state in `path` was entered on */
at: number[];
/** the machine's steps so far, from 0 */
n: number;
/** the edge the last transition took, an index into `machine.edges` */
e: number;
/** the decider that chose the last transition (absent: a guard did) */
by?: string;
/** each history state's last substate */
hist?: { [S in N]?: N };
}
/** A machine's state in some context, for a trace (`Playtest.machines`). */
export interface Watched {
/** the machine */
machine: AnyMachine;
/** its runtime state in that context */
snapshot: Snapshot;
}
@@ -124,29 +135,37 @@ export function inState<N extends string>(snap: Snapshot<N>, name: N): boolean {
/** A choice point as a decider sees it: which machine, where, and the candidates whose guards hold. */
export interface ChoicePoint<C = unknown, E = unknown> {
/** the machine's id */
machine: string;
/** the state whose `choose` list this is, and the active leaf */
state: string;
/** the active leaf state */
leaf: string;
/** the machine's step */
n: number;
/** the candidates whose guards hold, in their order (each an edge of machine.edges) */
candidates: { edge: number; to: string; description?: string }[];
/** the context the machine drives */
ctx: C;
/** whatever the step was given as env */
env: E;
}
/** What a decider answers: the edge it picks (one of the candidates' `edge`), or null to wait this step; `evidence` is
* whatever supports the choice (a bot's score, a model's probabilities), recorded beside the transition. */
export interface Decision {
/** the edge picked, one of the candidates' `edge`; null waits this step */
edge: number | null;
/** what supports the choice (a bot's score, a model's probabilities), recorded with the transition */
evidence?: unknown;
}
/** Picks a transition at a choice point. Called inside the step, so it must answer synchronously: a model or a person
* is asked outside the step and their answer replayed (`replayDecider`). Deterministic deciders keep a fold pure. */
export interface Decider {
/** its name in the trace's `by` column */
name: string;
/** picks a candidate at a choice point, synchronously */
decide(point: ChoicePoint): Decision;
}
@@ -169,14 +188,21 @@ export function replayDecider(log: Record<string, Record<number, number | { edge
/** One transition as a row: what a trace keeps and rdb loads (step, machine, from, to, edge, decider, evidence). `from` is
* null for the first step's entry into the initial states. */
export interface TransitionRecord {
/** the machine's id */
machine: string;
/** the machine's step it happened on */
step: number;
/** the leaf it left (null for the first entry) */
from: string | null;
/** the leaf it entered */
to: string;
/** the edge it took, an index into `machine.edges` */
edge: number;
/** what kind of edge: always, after, on, choose, done (an onDone), or start for the first entry */
kind: Edge["kind"] | "start";
/** "guard" for a trigger, "start" for the first entry, else the decider's name */
by: string;
/** the decider's evidence for the choice */
evidence?: unknown;
}
+3
View File
@@ -4,8 +4,11 @@
export type AssetKind = "lyria" | "sao" | "tokensynth";
export interface GeneratedAsset {
/** which generator makes it: lyria (music), sao (sound effects) or tokensynth (an instrument's note) */
kind: AssetKind;
/** what to make, in words */
prompt: string;
/** how long it is */
seconds: number;
/** a stable hash of kind, prompt and seconds */
id: string;
+11
View File
@@ -17,29 +17,37 @@ export interface GlbMaterial {
unlit?: boolean;
/** alpha-blended (the colour's alpha, times the vertex colours' alpha) */
blend?: boolean;
/** draw the back faces too */
doubleSided?: boolean;
/** 0..1, smooth to matte */
roughness?: number;
/** 0..1, a dielectric to a metal */
metalness?: number;
/** the colour it glows with */
emissive?: string;
}
export interface GlbPrimitive {
/** x y z per vertex */
positions: ArrayLike<number>;
/** x y z per vertex, unit length */
normals?: ArrayLike<number>;
/** r g b a per vertex, linear 0..1 (multiplies the material's colour) */
colors?: ArrayLike<number>;
/** by threes for triangles, by twos for lines; none: every vertex in order */
indices?: ArrayLike<number>;
/** what the indices draw: triangles (the default) or lines */
mode?: "triangles" | "lines";
/** four joint indices per vertex (a skinned mesh) */
joints?: ArrayLike<number>;
/** four weights per vertex, summing to 1 */
weights?: ArrayLike<number>;
/** its surface: colour, roughness, metalness, glow */
material?: GlbMaterial;
}
export interface GlbJoint {
/** the joint's name (a bone's, as a retarget maps it) */
name: string;
/** index of the parent joint, -1 for a root */
parent: number;
@@ -48,6 +56,7 @@ export interface GlbJoint {
}
export interface GlbClip {
/** the clip's name, as a Model's \`animation\` picks it */
name: string;
/** sample times (any unit the Model's `time` uses) */
times: ArrayLike<number>;
@@ -58,9 +67,11 @@ export interface GlbClip {
}
export interface GlbScene {
/** the meshes it holds */
primitives: GlbPrimitive[];
/** a skin: all primitives are skinned by these joints when it's given */
joints?: GlbJoint[];
/** animation clips over the joints */
clips?: GlbClip[];
}
+1
View File
@@ -25,6 +25,7 @@ export interface SeedlingProps {
volume?: number;
/** playback speed (default 1); may change frame to frame */
speed?: number;
/** start again from the beginning when it ends */
loop?: boolean;
/** a serial chain of effects on this player */
fx?: SeedlingFx[];
+54
View File
@@ -6,19 +6,26 @@ export type SongLevel = "intro" | "low" | "mid" | "high" | "outro";
/** A hit inside a stop: `time` on the beat grid (a beat or half beat), `at` where the onset is. */
export interface SongHit {
/** seconds from the song's start, snapped to the beat grid (a beat or half beat) */
time: number;
/** seconds from the song's start where the onset itself is */
at: number;
/** how hard the hit is, 0..1 */
strength: number;
}
export interface SongEvent {
/** what the event is: build, drop, stop, hit, dip or break */
kind: SongEventKind;
/** seconds from the song's start: a beat (drop, a downbeat) or the grid's nearest beat or half beat (hit) */
time: number;
/** spans (build, stop, dip, break) end here */
end?: number;
/** the index of the beat it starts on, in `SongMap.beats` */
beat: number;
/** the index of the bar it starts in */
bar: number;
/** a span: how many beats it lasts */
beats?: number;
/** 0..1 */
strength: number;
@@ -30,63 +37,97 @@ export interface SongEvent {
rise?: number;
/** a drop: the bar after stays up (false: one hit, then the band cuts out) */
holds?: boolean;
/** a drop: it comes straight out of a stop */
afterStop?: boolean;
/** a drop: it lands at the end of a build (within two bars of it) */
afterBuild?: boolean;
/** a drop: a breath of near-silence just before it */
gapBefore?: boolean;
/** a hit: the onset's own time; how far over the groove it stands */
at?: number;
/** a hit: how far over the groove it stands */
over?: number;
}
export interface SongSection {
/** the section's marker name when the song file has markers, else its level */
name: string;
/** how high the section sits in the song: intro, low, mid, high or outro */
level: SongLevel;
/** seconds from the song's start where the section begins */
time: number;
/** seconds from the song's start where it ends */
end: number;
/** the index of its first beat */
beat: number;
/** the index of its first bar */
bar: number;
/** its mean energy, 0..1 */
energy: number;
/** suggested cuts per bar: 0.25, 0.5, 1, 2 or 4 */
cuts: number;
}
export interface SongBar {
/** seconds from the song's start where the bar begins (its downbeat) */
time: number;
/** the index of its first beat */
beat: number;
/** how many beats it holds */
beats: number;
/** its mean energy, 0..1 */
energy: number;
/** suggested cuts in this bar: 0.25, 0.5, 1, 2 or 4 */
cuts: number;
}
export interface SongFeatures {
/** loudness (RMS) a beat, 0..1 over the song */
loudness: number[];
/** onset strength (spectral flux) a beat, 0..1: how much is struck */
onsets: number[];
/** brightness (spectral centroid) a beat, 0..1 */
brightness: number[];
/** the low end (kick and bass, under 150 Hz) a beat, 0..1 */
low: number[];
/** the high band (over 3 kHz) a beat, 0..1 */
high: number[];
/** the combined energy a beat, 0..1: loudness, low end, onsets and highs together */
energy: number[];
}
export interface SongMap {
/** the map format's version (1) */
version: number;
/** the song's length in seconds */
duration: number;
/** beats per minute, or null when no beat was found */
tempo: number | null;
/** beats in a bar (4 for 4/4) */
beatsPerBar: number;
/** every beat's time in seconds, ascending */
beats: number[];
/** every bar's first beat, in seconds */
downbeats: number[];
/** one value a beat, 0..1 over the song */
features: SongFeatures;
/** the bars in order, each with its energy and suggested cut rate */
bars: SongBar[];
/** the song's sections in order (intro, verse, chorus and so on) */
sections: SongSection[];
/** builds, drops, stops, hits, dips and breaks, in time order */
events: SongEvent[];
/** where the sections came from: the song file's markers, or novelty in the music itself */
sectionsFrom?: "markers" | "novelty";
/** the candidate section boundaries novelty found, each with its strength 0..1 */
boundaries?: { time: number; beat: number; bar: number; strength: number }[];
/** the song file's name */
source?: string | null;
}
/** Where a moment of the song is. Seconds are the song's; infinities when there's no such event. */
export interface SongMoment {
/** the moment, seconds from the song's start */
time: number;
/** the beat at or before `time` (-1 before the first) */
beat: number;
@@ -96,14 +137,21 @@ export interface SongMoment {
beatInBar: number;
/** 0..1 through the beat, and through the bar */
phase: number;
/** 0..1 through the bar */
barPhase: number;
/** the features at `time`, interpolated between beats */
energy: number;
/** loudness at `time`, 0..1 */
loudness: number;
/** onset strength at `time`, 0..1 */
onsets: number;
/** brightness at `time`, 0..1 */
brightness: number;
/** the low end at `time`, 0..1 */
low: number;
/** the section `time` is in (null before the first) */
section: SongSection | null;
/** that section's index in `SongMap.sections` (-1 for none) */
sectionIndex: number;
/** 0..1 through the section */
sectionProgress: number;
@@ -111,15 +159,21 @@ export interface SongMoment {
cutsPerBar: number;
/** the last drop at or before `time`, the next after it */
drop: SongEvent | null;
/** the next drop after `time` */
nextDrop: SongEvent | null;
/** seconds since the last drop (Infinity when there's none) */
sinceDrop: number;
/** seconds until the next drop (Infinity when there's none) */
untilDrop: number;
/** the build `time` is in, and 0..1 through it */
build: SongEvent | null;
/** whether `time` is inside a build */
inBuild: boolean;
/** 0..1 through that build */
buildProgress: number;
/** the stop `time` is in */
stop: SongEvent | null;
/** whether `time` is inside a stop */
inStop: boolean;
/** the dip or break `time` is in */
dip: SongEvent | null;
+4
View File
@@ -10,9 +10,13 @@ const EVENT_COLOUR: Record<SongEventKind, string> = {
};
export interface SongPlotProps {
/** the song's map, from \`raea song\` */
map: SongMap;
/** in px */
width?: number;
/** in px */
height?: number;
/** the heading (the song's name, tempo, metre and length by default) */
title?: string;
}
+3
View File
@@ -32,8 +32,11 @@ export interface CutOptions extends FrameRange {
}
export interface Song {
/** the song's map, from \`raea song\` */
map: SongMap;
/** the composition's frame rate, that frames are counted in */
fps: number;
/** seconds into the song frame 0 falls on (0) */
offset: number;
/** the frame a song time falls on */
frame(seconds: number): number;
+1
View File
@@ -24,6 +24,7 @@
import { native } from "raea/native";
export interface Line {
/** the words to say */
text: string;
/** a Pocket voice ("alba", "marius", ...), a clip in ~/.raea-feed/voices by name ("watts"), or a WAV
* ("/media/narrator.wav" or staticFile("narrator.wav")); the default is "watts" when that clip's there, else alba */
+7
View File
@@ -23,12 +23,17 @@ const STAGES: Stage[] = ["clip", "blend", "plant", "elbows", "gaze"];
export interface Finding {
/** first and peak frames */
frame: number;
/** the frame it's worst on */
peak: number;
/** how many frames it lasts */
frames: number;
/** the joint it's on */
joint: string;
/** what's wrong: too fast (speed), a jolt (jerk) or a joint bent past its limit (buckle) */
kind: "speed" | "jerk" | "buckle";
/** the peak's value (degrees a frame, a frame², or degrees past the clip's knee) and what the library allows */
value: number;
/** what the library allows */
limit: number;
/** the first stage that shows it */
stage: Stage;
@@ -37,7 +42,9 @@ export interface Finding {
}
export interface Lint {
/** what's wrong, each with its frames, joint and cause */
findings: Finding[];
/** how many frames were checked */
frames: number;
}
+4
View File
@@ -18,14 +18,18 @@ export interface AnimateOwnProps {
exitAt?: number;
/** a timeline's plan and this element's part in it: the part's move, at its start (plus `at`) */
timeline?: Plan;
/** the part in \`timeline\` whose move this element plays */
part?: string;
/** "always" (default): in the tree, and its layout, the whole time (invisible before an entrance that fades in);
* "during": only from the entrance's start until the exit ends (it takes its space when it arrives) */
mount?: "during" | "always";
/** the element: "div" by default */
as?: string;
/** inline style */
style?: CSSProperties;
/** Tailwind or CSS classes */
className?: string;
/** what moves */
children?: ReactNode;
}
+8
View File
@@ -28,14 +28,21 @@ export type Keys<V = number | string> = Record<number, V>;
/** One property's keyframes: values by frame, the curve between each pair (one for all, or one per segment). */
export interface TrackSpec<V = number | string> {
/** [frame, value] pairs in frame order, frames from the move's start */
keys: [number, V][];
/** the curve between keys: one for all, or one a segment */
ease: Curve | Curve[];
/** a length's unit: px (the default) or % */
unit?: "px" | "%";
/** past the last key: hold (the default), loop or pingpong, for ever or N times ("loop:3") */
repeat?: "hold" | "loop" | "pingpong" | `${"loop" | "pingpong"}:${number}`;
/** decimals a `text` counter writes */
digits?: number;
/** a `text` counter's text before and after the number, and between its thousands ("," writes 12,345) */
prefix?: string;
/** written after a `text` counter's number (" pts") */
suffix?: string;
/** between a `text` counter's thousands ("," writes 12,345) */
separator?: string;
}
@@ -94,6 +101,7 @@ function makeTrack<V>(keys: Keys<V>, ease: Curve | Curve[], opts: Omit<TrackSpec
/** Tracks by property, in frames from the move's own start. */
export interface Move {
/** keyframes by property, in frames from the move's start */
tracks: Record<string, TrackSpec | TrackSpec[]>;
/** how long it runs (its last key) */
frames: number;
+4
View File
@@ -10,7 +10,9 @@ import { Move, MoveLike, move, toMove } from "./all";
export type Step = [part: string, move: MoveLike] | { part: string; move: MoveLike; offset?: number } | Group | number;
export interface Group {
/** sequence: one after another; parallel: together */
kind: "sequence" | "parallel";
/** its steps, in order */
steps: Step[];
/** frames between steps of a sequence (negative overlaps) */
gap: number;
@@ -63,7 +65,9 @@ export function gridDelay(cols: number, rows: number, from: GridFrom, index: num
/** A timeline's plan: each part's start frame and move, and the whole length. */
export interface Plan {
/** each part's start frame and move, by its name */
parts: Record<string, { at: number; move: Move }>;
/** the whole timeline's length in frames */
frames: number;
}
+3
View File
@@ -4,8 +4,11 @@ import type { EasingFn } from "./easing";
export type ExtrapolateMode = "extend" | "clamp" | "identity" | "wrap";
export interface InterpolateOptions {
/** the curve between keyframes: one for all, or one a segment */
easing?: EasingFn | EasingFn[];
/** below the first keyframe: extend the line (default), clamp to it, identity (the input itself) or wrap */
extrapolateLeft?: ExtrapolateMode;
/** past the last keyframe: extend (default), clamp, identity or wrap */
extrapolateRight?: ExtrapolateMode;
}
+13
View File
@@ -2,21 +2,34 @@
// m x'' + c x' + k (x - to) = 0, x(0) = from, x'(0) = 0, solved in closed form for each damping regime.
export interface SpringConfig {
/** how heavy the spring's weight is (1): heavier is slower and swings further */
mass?: number;
/** how fast the swing dies (10): lower bounces more */
damping?: number;
/** how hard the spring pulls (100): stiffer is quicker */
stiffness?: number;
/** stop at `to` the first time it gets there, with no overshoot (false) */
overshootClamping?: boolean;
}
export interface SpringOptions {
/** the frame to sample, usually useCurrentFrame() */
frame: number;
/** frames a second, from useVideoConfig() */
fps: number;
/** the value it starts at (0) */
from?: number;
/** the value it settles at (1) */
to?: number;
/** the spring: mass, damping, stiffness, overshootClamping */
config?: SpringConfig;
/** stretch or squeeze the spring to settle in this many frames */
durationInFrames?: number;
/** how close to `to`, as a share of the travel, counts as settled when timing it (0.005) */
durationRestThreshold?: number;
/** frames before it starts (0) */
delay?: number;
/** play it backwards: from `to` back to `from` */
reverse?: boolean;
}
+20
View File
@@ -16,44 +16,59 @@ export interface Impulse {
impulse?: Vec3;
/** where it's applied (world, metres): off the centre it spins the body too */
at?: Vec3;
/** an angular impulse, N·m·s, world */
torque?: Vec3;
}
export interface BodyProps {
/** the body's name, unique in its <Physics>: the bake keys its track by it */
name: string;
/** a glTF's nodes as the body (drawn as a <Part>, its collider their hull) */
src?: string;
/** the glTF nodes that make the body */
nodes?: string[];
/** "hull" (default for nodes), "box" (their bounds), "mesh" (exact triangles, fixed bodies only), or a shape */
shape?: Shape;
/** where a given shape's centre stands at rest, world (a nodes' body: the middle of their bounds) */
centre?: Vec3;
/** it never moves: a floor, a wall, a table */
fixed?: boolean;
/** kg (else volume x density) */
mass?: number;
/** kg/m³ (1000) */
density?: number;
/** 0 slides, 1 grips (0.5) */
friction?: number;
/** 0 lands dead, 1 bounces back fully (0.2) */
restitution?: number;
/** m/s at the start, world */
velocity?: Vec3;
/** radians a second at the start, world */
angularVelocity?: Vec3;
/** how fast its motion bleeds off (0) */
linearDamping?: number;
/** how fast its spin bleeds off (0.05) */
angularDamping?: number;
/** seconds: held where it is until then (a cup sits until it's knocked) */
release?: number;
/** kicks at given seconds: an impulse, where it's applied, and a torque */
impulses?: Impulse[];
/** a kinematic mover: its rigid motion from rest at t seconds (see `about`); it pushes the others */
path?: (t: number) => { position: Vec3; quaternion: Quat };
/** drawn as the body's nodes are, or by its children (inside its motion: draw them where it stands at rest) */
material?: PartMaterial;
/** how its part breaks up, or a function of seconds giving that */
glitch?: Glitch | ((t: number) => Glitch | undefined);
/** it casts shadows */
castShadow?: boolean;
/** what draws the body, in place of its nodes */
children?: ReactNode;
}
export interface PhysicsProps {
/** how long to simulate, seconds */
seconds: number;
/** m/s² (0, -9.81, 0) */
gravity?: Vec3;
/** steps per frame (8) */
substeps?: number;
@@ -61,13 +76,18 @@ export interface PhysicsProps {
colliders?: { min: Vec3; max: Vec3; friction?: number; restitution?: number }[];
/** the frame (of the enclosing Sequence) the simulation starts on (0); before it everything is at rest */
from?: number;
/** the <Body> elements to simulate, and anything else to draw */
children?: ReactNode;
}
export interface Baked {
/** the frame rate it was baked at */
fps: number;
/** how many frames it holds */
frames: number;
/** the bake's file in the asset store */
file: string;
/** each body's track by name: positions and quaternions a frame, flat, and its rest centre */
bodies: Record<string, { p: number[]; q: number[]; centre: Vec3 }>;
}
+35 -2
View File
@@ -87,20 +87,30 @@ export function about(about: Vec3, q: Quat, move: Vec3 = [0, 0, 0]): { position:
// ---- parts ----------------------------------------------------------------------------------------------------
export interface PartInfo {
/** the part's own .glb in the asset store */
file: string;
/** the middle of its bounds, metres, where it stands in the source file */
centre: Vec3;
/** its bounds' low corner */
lo: Vec3;
/** its bounds' high corner */
hi: Vec3;
/** how many triangles it has */
tris: number;
}
export interface PartMaterial {
/** the magenta-and-black checker of a texture that didn't load */
missing?: boolean;
/** a colour over its own */
color?: string;
/** the colour it glows with */
emissive?: string;
/** 0..1, see-through to solid */
opacity?: number;
/** 0..1, smooth to matte */
roughness?: number;
/** drawn in its flat colour, without light or shade */
unlit?: boolean;
}
@@ -134,16 +144,23 @@ export interface Glitch {
}
export interface PartProps {
/** the entity's name (the first node's by default) */
name?: string;
/** the glTF (staticFile("x.glb")) and the nodes that make the part */
src: string;
/** the glTF nodes that make the part */
nodes: string[];
/** a rigid motion from where it stands in the file (see `about`): position, and a quaternion [x, y, z, w] */
position?: Vec3;
/** its turn as a quaternion [x, y, z, w] (see `about`) */
quaternion?: Quat;
/** a uniform scale (1) */
scale?: number;
/** a material over the part's own (colour, glow, opacity) */
material?: PartMaterial;
/** how the part breaks up this frame: explode, scramble, jitter, snap, smear */
glitch?: Glitch;
/** it casts shadows */
castShadow?: boolean;
}
@@ -156,9 +173,18 @@ export function Part(p: PartProps) {
node("Model", { src: info.file, name: p.name, time: 0, castShadow: p.castShadow, allowOverlap: true, ...(glitch ? { glitch } : {}) }));
}
export interface EchoesProps extends PartProps {
/** how many echoes trail the part */
count: number;
/** metres between one echo and the next, or a function of the echo's number (1, 2, ...) giving its offset */
step: Vec3 | ((k: number) => Vec3);
/** the echoes' material (the part's by default): a flat glowing one reads as copies */
echo?: PartMaterial;
}
/** Copies of a part trailing it: `count` echoes at offsets `step` apart (metres; or a function of the echo's number),
* in a flat glowing `material`, so a fork "duplicates" along a line. */
export function Echoes(p: PartProps & { count: number; step: Vec3 | ((k: number) => Vec3); echo?: PartMaterial }) {
export function Echoes(p: EchoesProps) {
const out: ReactNode[] = [];
for (let k = 1; k <= p.count; k++) {
const o = typeof p.step === "function" ? p.step(k) : (p.step.map((x) => x * k) as Vec3);
@@ -168,9 +194,16 @@ export function Echoes(p: PartProps & { count: number; step: Vec3 | ((k: number)
return <>{out}</>;
}
export interface ZFightProps extends PartProps {
/** radians the second copy is turned (~0.002): more is stronger stripes */
amount: number;
/** the second copy's material */
other?: PartMaterial;
}
/** The part drawn twice in the same place, the second a hair turned, in another material: the two surfaces fight
* for the depth buffer and flicker in stripes (z-fighting), stronger with `amount` (radians, ~0.002). */
export function ZFight(p: PartProps & { amount: number; other?: PartMaterial }) {
export function ZFight(p: ZFightProps) {
const info = part(p.src, p.nodes);
const q = quatMul(p.quaternion ?? [0, 0, 0, 1], quatAxis([0.3, 1, 0.2], p.amount));
const m = about(info.centre, quatAxis([0.3, 1, 0.2], p.amount));
+36
View File
@@ -7,35 +7,49 @@ import { node } from "./all";
// ---- mesh sequences and goo -----------------------------------------------------------------------------------
export interface MeshSequenceProps {
/** the entity's name, for picking and the inspector */
name?: string;
/** a .rseq (tools/goo writes them; raea_render::meshseq) */
src: string;
/** which of its frames (clamped) */
frame: number;
/** where it stands, metres (x, y, z) */
position?: Vec3;
/** its rotation, Euler angles in radians (x, y, z) */
rotation?: Vec3;
/** a uniform scale */
scale?: number;
/** multiplies the vertex colours */
color?: string;
/** 0..1, smooth to matte */
roughness?: number;
/** 0..1, a dielectric to a metal */
metalness?: number;
/** 0..1 strength of a clear varnish layer over the surface */
clearcoat?: number;
/** 0..1 roughness of that clear layer */
clearcoatRoughness?: number;
/** 0..1 specular strength at normal incidence (0.5: 4%, a dielectric's) */
reflectance?: number;
/** 0..1 light let through (diffuse transmission): a jelly's glow */
subsurface?: number;
/** how thick the mesh is, metres, for the light let through */
thickness?: number;
/** 0..1 light let straight through and bent (a clear liquid: water, tea, juice), with its index of refraction (1.33
* water) and, for a tinted one, the colour it takes after `attenuationDistance` metres through it. Screen space: it
* refracts what's on screen behind it, and one clear layer doesn't show another through it */
transmission?: number;
/** the index of refraction of what light passes through (1.33 water) */
ior?: number;
/** the colour light takes after `attenuationDistance` metres through it */
attenuationColor?: string;
/** metres through it until light has taken `attenuationColor` */
attenuationDistance?: number;
/** 0..1, see-through to solid */
opacity?: number;
/** a picture over its texture coordinates */
map?: string;
/** draw the back faces too (an open shell, a petal) */
doubleSided?: boolean;
}
@@ -48,35 +62,47 @@ export function MeshSequence(p: MeshSequenceProps) {
}
export interface GooObject {
/** the object's name; the bake's stats list it, with the frame its original model should go */
name: string;
/** a glTF's nodes (world space as they stand in it), moved by `transform` (column-major 4x4) if given; or, with no
* src, `cup` and `level`: a liquid filling one of the goo's cups to `level` metres above its foot */
src?: string;
/** the glTF nodes it's made of (all of them when left out) */
nodes?: string[];
/** with no src: the index of the cup in `cups` it fills */
cup?: number;
/** with no src: metres above the cup's foot it's filled to */
level?: number;
/** a column-major 4x4 that moves the glTF's nodes */
transform?: number[];
/** sph: what it is ("water" by default: coffee, tea, milk, juice, oil, syrup, honey set its colour, density and
* viscosity), and where it comes from if not a cup or a glTF (filled): a box of it, or an emitter pouring a round
* stream from `at` along `dir` (down) at `speed` m/s, `radius` m (6 mm) across, from `start` to `end` seconds */
liquid?: "water" | "coffee" | "tea" | "milk" | "juice" | "oil" | "syrup" | "honey";
/** sph: a box of liquid, world min and max corners */
block?: { min: Vec3; max: Vec3 };
/** sph: a round stream poured from `at` along `dir`, `radius` m across, at `speed` m/s, from `start` to `end` seconds */
emitter?: { at: Vec3; dir?: Vec3; radius?: number; speed?: number; start?: number; end?: number };
/** seconds from the goo's start when it begins to soften, and how long until it runs (mpm) */
start: number;
/** seconds from `start` until it runs (2) */
melt?: number;
/** of the solid (3e4) and the fluid it becomes (4) */
stiffness?: number;
/** how thick the fluid it becomes is (4) */
viscosity?: number;
/** its density, kg/m³ (1000) */
density?: number;
/** the share of its pressure it keeps under tension (0.6): goo holds together in strands, a liquid (0.02) barely */
cohesion?: number;
/** the share of its shear stiffness a fluid keeps (0.12) and the strain it must pass to flow (0.005): 0 and 0 for a
* liquid */
residual?: number;
/** the strain a fluid must pass to flow (0.005; 0 for a liquid) */
yield?: number;
/** "solid" fills its volume; "shell" a skin `thickness` thick (plates, petals) */
fill?: "solid" | "shell";
/** with `fill: "shell"`: the skin's thickness, metres */
thickness?: number;
/** its goo's colour (else its texture's) */
color?: string;
@@ -92,10 +118,13 @@ export interface GooCup {
}
export interface GooProps {
/** the entity's name, for picking and the inspector */
name?: string;
/** how long, seconds, from `from` (a frame of the enclosing Sequence) */
seconds: number;
/** the frame of the enclosing Sequence the bake starts at (0) */
from?: number;
/** what goes in: solids that melt and liquids that pour */
objects: GooObject[];
/** static boxes the goo lies on and runs off (world) */
colliders?: { box: { min: Vec3; max: Vec3 }; friction?: number }[];
@@ -127,17 +156,24 @@ export interface GooProps {
bounds?: { min: Vec3; max: Vec3 };
/** grid cell, metres (0.005): finer is slower and smoother */
dx?: number;
/** the random seed the particles are placed with: the same seed bakes the same goo (0) */
seed?: number;
/** gravity, m/s² (0, -9.81, 0) */
gravity?: Vec3;
/** the surface: glossy, a little light through it */
roughness?: number;
/** 0..1 clear varnish over the surface */
clearcoat?: number;
/** 0..1 light let through the surface */
subsurface?: number;
/** the goo's colour where an object gives none */
color?: string;
}
export interface GooBake {
/** the baked .rseq this goo plays */
file: string;
/** what the bake measured, with each object's name and the frame its original model should go */
stats: { objects?: { name: string; hideFrame: number }[]; [k: string]: unknown };
}
+1
View File
@@ -5,6 +5,7 @@ export * from "./materials";
export * from "./lights";
export * from "./model";
export * from "./effects";
export * from "./volumetric";
export * from "./post";
export * from "./look";
export * from "./bevy";
+8
View File
@@ -4,15 +4,20 @@ import { samplerSpec, type SamplerSpec } from "./materials";
/** What a <Sprite> takes to show a built atlas: the whole of it, or one of its pictures (`atlasPick`). */
export interface AtlasSprite {
/** the atlas picture */
src: string;
/** how it's sampled (the atlas's own sampler) */
sampler?: SamplerSpec;
/** which of its pictures shows (the whole atlas when left out) */
atlasPick?: number;
}
/** A built atlas: `image` the whole atlas as a sprite's picture, `sources.handle(texture)` one picture of it
* (TextureAtlasSources::handle). */
export interface BuiltAtlas {
/** the whole atlas, as a sprite's picture */
image: AtlasSprite;
/** \`handle(texture)\`: one of the pictures packed into it, by its file */
sources: { handle(texture: string): AtlasSprite };
}
@@ -24,18 +29,21 @@ export class TextureAtlasBuilder {
private pad: [number, number] = [0, 0];
private textures: string[] = [];
/** Whole px of space around each picture, [x, y]. */
padding(p: [number, number]): this {
if (!(Array.isArray(p) && p.length === 2 && p.every((n) => Number.isInteger(n) && n >= 0))) throw new TypeError(`TextureAtlasBuilder: padding is [x, y], whole px of 0 or more, got ${JSON.stringify(p)}`);
this.pad = p;
return this;
}
/** Adds a picture, packed in the order added. */
addTexture(src: string): this {
if (typeof src !== "string" || src === "" || src.startsWith("render:") || src.startsWith("atlas:")) throw new TypeError(`TextureAtlasBuilder: a texture is a picture (staticFile("x.png")), got ${JSON.stringify(src)}`);
this.textures.push(src);
return this;
}
/** Packs the atlas, with its own sampler if given (Bevy's default otherwise). */
build({ sampler }: { sampler?: SamplerSpec } = {}): BuiltAtlas {
if (this.textures.length === 0) throw new TypeError("TextureAtlasBuilder: add a texture before build()");
if (sampler !== undefined) samplerSpec("TextureAtlasBuilder: sampler", sampler);
+18 -1
View File
@@ -56,9 +56,13 @@ export interface GizmoProps {
width?: number;
/** -1 always in front of geometry, 0 depth-tested as it is (Bevy's GizmoLineConfig and depth_bias) */
depthBias?: number;
/** where it stands, metres (x, y, z) */
position?: Vec3;
/** its rotation, Euler angles in radians (x, y, z) */
rotation?: Vec3;
/** its scale: one number, or x, y and z */
scale?: Vec3 | number;
/** the entity's name, for picking, the inspector and world.* */
name?: string;
}
@@ -110,11 +114,17 @@ export interface ShaderMeshProps {
textures?: Record<string, string | Record<string, unknown>>;
/** shader defs: each NAME a WESL condition for `@if(NAME)`, and a whole number also `constants::NAME` */
defs?: ShaderDefs;
/** how it blends: opaque, blend, add or premultiplied */
alpha?: "opaque" | "blend" | "add" | "premultiplied";
/** draw the back faces too */
doubleSided?: boolean;
/** the entity's name, for picking, the inspector and world.* */
name?: string;
/** where it stands, metres (x, y, z) */
position?: Vec3;
/** its rotation, Euler angles in radians (x, y, z) */
rotation?: Vec3;
/** its scale: one number, or x, y and z */
scale?: Vec3 | number;
}
@@ -146,8 +156,15 @@ export function ShaderMesh({ shape, wesl, wgsl, uniforms = {}, textures = {}, de
);
}
export interface BevyResourceProps {
/** the resource's Rust type path, as the TypeRegistry names it */
type: string;
/** its value as Bevy reflects it (JSON) */
value: unknown;
}
/** A Bevy resource (a plugin's settings: gravity), applied through the TypeRegistry. Inside the Canvas3D. */
export function BevyResource(props: { type: string; value: unknown }) {
export function BevyResource(props: BevyResourceProps) {
if (typeof props.type !== "string" || !props.type.includes("::")) throw new TypeError(`BevyResource: type is a full type path, got ${JSON.stringify(props.type)}`);
return node3d("BevyResource", { type: props.type, value: props.value ?? null });
}
+6 -1
View File
@@ -37,7 +37,12 @@ export interface ComputeProps {
* for its compute to write (shader_advanced/compute_mesh): the mesh the part named `mesh` holds, a <BufferMesh> with
* indices and normals (position, normal and uv interleaved, 8 floats a vertex).
* @bevy bevy_render::mesh::allocator::MeshBufferSlice */
export interface MeshSlab { mesh: string; slab: "vertices" | "indices" }
export interface MeshSlab {
/** the mesh's name */
mesh: string;
/** which of its buffers: vertices or indices */
slab: "vertices" | "indices";
}
type SlabRange = { start: string } | { end: string };
const storageValue = (x: unknown): boolean => Number.isFinite(x) || (Array.isArray(x) && x.every(storageValue)) || (typeof x === "object" && x !== null && Object.values(x).every(storageValue));
+1
View File
@@ -46,6 +46,7 @@ export interface Canvas3DProps {
* it in linear light, as Bevy's do over its ClearColor (a Bevy 2D scene's rgb(43, 44, 47)), not over the page in sRGB.
* The 3D then lies under the whole page, as Bevy's camera output lies under all its UI (a GlobalZIndex(-1) too). */
clearColor?: string;
/** the 3D scene: cameras, lights and parts */
children?: ReactNode;
[prop: string]: unknown;
}
+12 -101
View File
@@ -1,4 +1,4 @@
// Image planes, decals, bloom, fog, grading, environment, ambient occlusion, shadows and volumetric fog.
// Image planes, decals, bloom, fog, grading, environment, ambient occlusion and shadows (volumetric fog in volumetric.tsx).
import { useCurrentFrame, useVideoConfig } from "@raea/app/clock";
import { ImagePlaneProps, Vec3, assetPath, checkShares, checkVec, colours, node3d } from "./all";
@@ -16,10 +16,13 @@ export function ImagePlane(props: ImagePlaneProps) {
export interface DecalProps {
/** the picture pressed onto the surface: staticFile("label.png"); its clear parts show the surface through */
src: string;
/** the entity's name, for picking, the inspector and world.* */
name?: string;
/** a normal map pressed with the picture: the label's relief */
normalMap?: string;
/** width by height in metres (a number: a square) */
size?: number | [number, number];
/** where it stands, metres (x, y, z) */
position?: Vec3;
/** which way the surface faces at the decal (out of it; [0, 1, 0], a floor or counter, by default): turns the decal
* so the picture lies on it, upright on a wall, its top toward -z on a floor. Instead of rotation */
@@ -32,8 +35,11 @@ export interface DecalProps {
color?: string;
/** 0 to 1 (keyed: a label fading in) */
opacity?: number;
/** 0..1, smooth to matte */
roughness?: number;
/** 0..1, a dielectric to a metal */
metalness?: number;
/** drawn in its flat colour, without light or shade */
unlit?: boolean;
/** how far off its plane (metres) it still lies on a surface, fading to nothing there (0.05 by default). Anything
* nearer the plane than this takes it, a cabinet's side or a fridge's as well as the wall: keep it small */
@@ -90,6 +96,7 @@ export function Decal(props: DecalProps) {
export interface PlateProps {
/** a video in the media folder: staticFile("clip.mp4") */
src: string;
/** the entity's name, for picking, the inspector and world.* */
name?: string;
/** the clip's time on this frame, in seconds (by default the Sequence's: frame / fps) */
time?: number;
@@ -145,6 +152,7 @@ export interface FogProps {
color?: FogColor;
/** linear fog from `near` to `far` (in the Canvas3D 5 and 20 by default; on the camera Bevy's 0 and 100) */
near?: number;
/** where linear fog is full, from the camera (20 in the Canvas3D, 100 on a camera) */
far?: number;
/** or exponential fog of this density (0.05-0.3), instead of near and far */
density?: number;
@@ -204,8 +212,11 @@ export interface GradeProps {
tint?: number;
/** the whole frame's saturation after tone mapping (1 keeps it) */
saturation?: number;
/** the grade on the shadows: saturation, contrast, gamma, gain, lift */
shadows?: GradeSection;
/** the grade on the midtones */
midtones?: GradeSection;
/** the grade on the highlights */
highlights?: GradeSection;
/** the corners darkened: 0 none, 1 black; or {intensity, radius (0.75), smoothness (5), color} */
vignette?: number | { intensity?: number; radius?: number; smoothness?: number; color?: string };
@@ -389,103 +400,3 @@ export function Shadows(props: ShadowsProps) {
if (props.filter !== undefined && !["gaussian", "hardware"].includes(props.filter)) throw new RangeError(`Shadows: filter must be "gaussian" or "hardware", got ${JSON.stringify(props.filter)}`);
return node3d("Shadows", props as unknown as Record<string, unknown>);
}
export interface VolumetricFogProps {
/** mode="march": samples along each ray through a fog volume (64 by default): too few stair-step a shaft's edges, so 128 for a
* render with hard-edged shafts, or 32 with `dither`; about 0.1 ms a step at 1920x1080 on an M5 Pro */
steps?: number;
/** mode="march": start each pixel's march a fraction of a step in, by a fixed noise seeded from the pixel and the frame number
* (false by default): the shafts' steps become fine grain instead of bands, so fewer steps look smooth. The noise
* is a function of the frame, so a render still equals its play */
dither?: boolean;
/** mode="march": the fraction of the frame's resolution the fog is marched at (1 by default): 0.5 marches a quarter of the
* pixels and puts the result over the frame guided by depth, so an edge in front of a shaft keeps no fog from
* what's behind it. 0.5, 1/3 or 0.25; each frame on its own, so a render still equals its play */
resolution?: number;
/** light the fog has everywhere, lit or not (0 by default). Bevy lights a volume's whole box with it whatever its
* density, so the box's edges show: keep it 0, or small with the camera inside the volume */
ambient?: number;
/** that light's colour (white by default) */
ambientColor?: string;
/** how the fog is drawn: "froxel" (the default: every volume written into one grid of cells along the view, lit
* once a cell and integrated front to back once, with the `hero` lights' shafts integrated exactly along epipolar lines: no
* steps, no dither, its cost the grid's whatever the resolution or the number of volumes, overlapping volumes mixed
* as one medium, see-through surfaces fogged at their own depth) or "march" (Bevy's ray march through each
* volume, as before). `steps`, `dither` and `resolution` are the march's; `slices`, `tile`, `samples` and `hero`
* the grid's */
mode?: "march" | "froxel";
/** the grid's cells along the view, spaced evenly in log depth from the camera to the farthest volume (64 by
* default; 32 to 256) */
slices?: number;
/** the grid's cells across the frame, in pixels a side (16 by default; 4, 8 or 16) */
tile?: number;
/** points lit in each cell, spread along its depth (1 by default; 1 to 8): more keeps thin shadows in the
* grid's soft light (a hero light's shafts don't need them) */
samples?: number;
/** the grid's shafts: true (the default) integrates the first two volumetric spot lights and the first two
* volumetric directional lights exactly, over their shadow maps texel by texel, so a blind's bars or a doorway's
* edge are as crisp as the shadow map: integrated at samples along lines from the light across the frame (Chen et
* al.'s epipolar sampling), more of them where the depth or the light changes, and each pixel read from the
* samples either side of it at its depth; false lights them in the grid's cells with the rest */
hero?: boolean;
}
/** Volumetric fog on the camera: light in the air, drawn inside every <FogVolume>, with shafts from the lights marked
* `volumetric`. Put it inside the Canvas3D, once; without it fog volumes draw nothing.
* @bevy bevy_light::volumetric::VolumetricFog
* @bevy bevy_light::volumetric::VolumetricLight */
export function VolumetricFog(props: VolumetricFogProps) {
if (props.steps !== undefined && !(Number.isInteger(props.steps) && props.steps >= 1 && props.steps <= 256)) throw new RangeError(`VolumetricFog: steps must be a whole number from 1 to 256, got ${props.steps}`);
if (props.dither !== undefined && typeof props.dither !== "boolean") throw new TypeError(`VolumetricFog: dither must be true or false, got ${JSON.stringify(props.dither)}`);
if (props.resolution !== undefined && !(props.resolution > 0 && props.resolution <= 1 && [1, 2, 3, 4].some((k) => Math.abs(props.resolution! * k - 1) < 1e-6))) throw new RangeError(`VolumetricFog: resolution must be 1, 0.5, 1/3 or 0.25, got ${props.resolution}`);
if (props.ambient !== undefined && !(props.ambient >= 0)) throw new RangeError(`VolumetricFog: ambient must be 0 or more, got ${props.ambient}`);
if (props.mode !== undefined && !["march", "froxel"].includes(props.mode)) throw new RangeError(`VolumetricFog: mode must be "march" or "froxel", got ${JSON.stringify(props.mode)}`);
if (props.slices !== undefined && !(Number.isInteger(props.slices) && props.slices >= 32 && props.slices <= 256)) throw new RangeError(`VolumetricFog: slices must be a whole number from 32 to 256, got ${props.slices}`);
if (props.tile !== undefined && ![4, 8, 16].includes(props.tile)) throw new RangeError(`VolumetricFog: tile must be 4, 8 or 16, got ${props.tile}`);
if (props.samples !== undefined && !(Number.isInteger(props.samples) && props.samples >= 1 && props.samples <= 8)) throw new RangeError(`VolumetricFog: samples must be a whole number from 1 to 8, got ${props.samples}`);
return node3d("VolumetricFog", colours("VolumetricFog", props as Record<string, unknown>, ["ambientColor"]));
}
export interface FogVolumeProps {
/** parts are matched by name across frames: name a volume that comes and goes */
name?: string;
/** the box's centre */
position?: Vec3;
/** radians */
rotation?: Vec3;
/** the box's size in metres: one number for a cube, or [x, y, z] (1 by default) */
scale?: number | Vec3;
/** how thick the air is (0.1 by default: dusty; 0.02 a faint haze; 0.5 smoke). Animate it to let dust settle,
* smoke roll in or a volume vanish (0) */
density?: number;
/** the fog's own colour, what light scattering out of it takes on (white by default; a dark red for blood in the
* air) */
color?: string;
/** how much light it swallows (0.3 by default): higher reads as soot or smoke */
absorption?: number;
/** how much light it throws back toward the eye (0.3 by default): higher reads as bright dust or mist */
scattering?: number;
/** how far forward it scatters, -1 to 1 (0.5 by default): near 1 the shafts glow when you look toward the light */
anisotropy?: number;
/** how fast it thins going up, per metre from the box's floor (0 by default: even throughout): 0.5 is a ground
* fog that's a third as thick two metres up. A box wide and tall with a falloff is height fog. Only
* <VolumetricFog mode="froxel"> draws it; the march draws the box evenly */
falloff?: number;
/** Bevy's density_texture: a 3D .ktx2 image in the media folder whose values scale the density through the box (a
* cloud, a bunny of smoke); the box draws evenly without one. Only the march draws it */
density_texture?: string;
}
/** A box of air that light shows in: dust in a sunbeam, smoke, a haze of blood. Needs a <VolumetricFog> in the
* Canvas3D; lights marked `volumetric` throw shafts through it, and every light's glow fills it softly. A part, so it
* keeps its name across frames: animate its density, colour and placement.
* @bevy bevy_light::volumetric::FogVolume */
export function FogVolume(props: FogVolumeProps) {
for (const k of ["position", "rotation"] as const) if (props[k] !== undefined) checkVec("FogVolume", k, props[k]);
if (props.density !== undefined && !(props.density >= 0 && Number.isFinite(props.density))) throw new RangeError(`FogVolume: density must be 0 or more, got ${props.density}`);
if (props.anisotropy !== undefined && !(props.anisotropy > -1 && props.anisotropy < 1)) throw new RangeError(`FogVolume: anisotropy must be between -1 and 1, got ${props.anisotropy}`);
const tex = props.density_texture;
if (tex !== undefined && !(typeof tex === "string" && /\.ktx2$/i.test(tex))) throw new TypeError(`FogVolume: density_texture is a 3D .ktx2 image, got ${JSON.stringify(tex)}`);
if (props.falloff !== undefined && !(props.falloff >= 0 && Number.isFinite(props.falloff))) throw new RangeError(`FogVolume: falloff must be 0 or more, got ${props.falloff}`);
return node3d("FogVolume", colours("FogVolume", (tex === undefined ? props : { ...props, density_texture: assetPath(tex) }) as Record<string, unknown>, ["color"]));
}
+11
View File
@@ -8,14 +8,20 @@ import { type PlanBox } from "./all";
/** One step of detail: tiles nearer than `to` metres draw `keep` of their clumps (0 to 1), each with its first
* `blades` blades in `segments` segments, `widen` times as wide. */
export interface GrassLod {
/** tiles nearer than this many metres take this step */
to: number;
/** the share of their clumps they draw, 0 to 1 */
keep: number;
/** how many of each clump's blades they draw */
blades: number;
/** segments each blade is drawn in */
segments: number;
/** how many times as wide each blade is drawn, to fill in for the ones left out */
widen: number;
}
export interface GrassProps {
/** the entity's name, for picking, the inspector and world.* */
name?: string;
/** the ground the field covers: a box on the plan (x, z, metres) */
area: PlanBox;
@@ -31,16 +37,21 @@ export interface GrassProps {
tints?: [string, string][];
/** the tips' highlight colour ("#f2e7a0") and how much of it each tip takes (0.22) */
highlight?: string;
/** how much of the highlight each tip takes (0.22) */
highlightMix?: number;
/** blades in a clump (14), their height in metres (0.3; each 0.55 to 1.3 times it), width range ([0.034, 0.05]) */
blades?: number;
/** their height in metres (0.3; each 0.55 to 1.3 times it) */
bladeHeight?: number;
/** a blade's width range, metres ([0.034, 0.05]) */
width?: [number, number];
/** how far from its clump's centre a blade stands (0.06 m), and how far it leans over its height ([0.2, 0.7]) */
spread?: number;
/** how far a blade leans over its height ([0.2, 0.7]) */
lean?: [number, number];
/** each clump's scale, a random pick between these ([0.85, 1.35]), times `size` */
scale?: [number, number];
/** which randomness places the clumps */
seed?: number;
/** grid points a metre the functions are sampled at (2) */
resolution?: number;
+9
View File
@@ -7,8 +7,11 @@ import { MeshToonMaterial, Vec3, checkPass, checkVec, node3d, shapeFromChildren
/** One copy's placement in an <Instances>, in the Instances' own space (its position, rotation and scale move every
* copy together). Rotation in radians, XYZ order, as everywhere. */
export interface Instance {
/** where this copy stands, metres, in the Instances' space */
position: Vec3;
/** its rotation, Euler angles in radians (x, y, z) */
rotation?: Vec3;
/** its scale: one number, or x, y and z */
scale?: number | Vec3;
}
@@ -19,10 +22,13 @@ export interface InstancesProps {
/** where each copy stands. Fixed for the shot: the first frame's list is drawn on every frame (move, turn, scale,
* hide or recolour the whole set by the Instances' own props) */
at: Instance[];
/** the entity's name, for picking, the inspector and world.* */
name?: string;
/** where it stands, metres (x, y, z) */
position?: Vec3;
/** radians */
rotation?: Vec3;
/** its scale: one number, or x, y and z */
scale?: number | Vec3;
/** of a glTF: which of its scenes (0 by default) */
scene?: number;
@@ -32,6 +38,7 @@ export interface InstancesProps {
shadow?: boolean;
/** false: no shadow falls on the copies */
receiveShadow?: boolean;
/** the composition pass it draws in ("scene" by default) */
pass?: string;
/** the mesh form: a geometry and a material (MeshStandardMaterial, MeshPhysicalMaterial or MeshBasicMaterial).
* The glTF form: MeshStandardMaterial children re-covering its materials, as on a Model */
@@ -90,7 +97,9 @@ export function Instances(props: InstancesProps) {
/** A box on the plan (x, z, metres): the room SDK's Footprint, or any { min, max }. */
export interface PlanBox {
/** the low corner (x, z), metres */
min: [number, number];
/** the high corner (x, z), metres */
max: [number, number];
}
+13 -1
View File
@@ -135,14 +135,21 @@ export interface LookProps {
/** One composition pass's own paint (<Look passes>): the frame's rag, grain and palette, and its surfaces' bands, torn
* shadow edge, strokes, saturation and wash; what it leaves out is the Look's. */
export interface LookPass {
/** how far its edges wander, px (the Look's by default) */
rag?: number;
/** its paper grain, 0 to 1 */
grain?: number;
/** false: its pixels aren't snapped to the palette */
palette?: boolean;
/** how many flat tones the light makes on its surfaces, 1-8 */
bands?: number;
/** how far its cast shadows' edges tear, 0 to 0.5 */
edge?: number;
/** brush strokes on its surfaces, 0 to 1 */
stroke?: number;
/** its colour past (above 1) or toward grey (below 1) its own */
saturate?: number;
/** its textures' colour taken as their patch average, 0 to 1 */
wash?: number;
}
@@ -281,10 +288,15 @@ export function Scene({ world }: SceneProps) {
);
}
export interface EntitiesProps {
/** the game's world at this frame: anything with \`scene()\` giving its entities */
world: { scene(): unknown[] };
}
/** A world's entities drawn by the engine (no React element per entity): every entity with a Mesh component ({shape:
* a Manifold expression or a Solid's expr, color, roughness, metalness}) and a Transform ({x, y, z, rx, ry, rz in
* radians, scale}) is a mesh, placed in world space (a child's Transform is in its parent's). Give it the world at the
* frame: `<Entities world={game.at(useCurrentFrame())} />`. Needs the engine's tables. */
export function Entities({ world }: { world: { scene(): unknown[] } }) {
export function Entities({ world }: EntitiesProps) {
return node3d("Entities", { scene: world.scene() });
}
+1
View File
@@ -131,6 +131,7 @@ export interface SurfaceShaderSpec {
defs?: ShaderDefs;
/** a <Material>'s own (FC2a): what its Material methods give, and its storage buffers; set by <Material> only */
own?: OwnMaterialFields;
/** the material's storage buffers by binding name; set by <Material> only */
buffers?: Record<string, StorageValue>;
}
+20 -1
View File
@@ -10,6 +10,7 @@ import { MeshStandardMaterialProps, PerspectiveCameraProps, Vec3, checkMaterial,
/** What a light or camera holds: Bevy's own reflected components on it (<BevyComponent>, or a generated wrapper such
* as bevy_light's ShadowFilteringMethod or bevy_pbr's ScreenSpaceReflections), applied through Bevy's TypeRegistry. */
export interface BevyParts {
/** Bevy components on it: <BevyComponent>, or a generated wrapper */
children?: ReactNode;
/** a camera: the render layers it draws ([0] by default); a light: the layers it lights (Bevy's RenderLayers) */
layers?: number[];
@@ -51,9 +52,11 @@ export function eulerOf(q: [number, number, number, number]): Vec3 {
export interface EntityProps {
/** what an Entity field elsewhere names it by (a ChildOf's parent, an observer's target); unique in the scene */
name?: string;
/** where it stands, metres (x, y, z) */
position?: Vec3;
/** Euler XYZ in radians */
rotation?: Vec3;
/** one number, or x, y and z */
scale?: Vec3 | number;
/** Bevy's Transform (Transform.fromXyz(..).withRotation(..)), in place of position, rotation and scale: the entity
* is then a parent whose children (meshes, lights, models, other entities) move with it, as Bevy's ChildOf
@@ -105,10 +108,17 @@ export interface GroupProps {
}
/** Moves, turns and scales everything inside it together (a product and its stand, a car and its wheels). */
export interface RefinishProps {
/** the finishes, each a <MeshStandardMaterial>'s props, over every glTF material or the one its `material` names */
materials: MeshStandardMaterialProps[];
/** the models refinished */
children?: ReactNode;
}
/** Every <Model> inside re-covered: each of its glTF materials (all, or the one each names by `material`) given the
* colour, texture or finish each gives, the rest of it kept (a run of cabinets painted, the doors and drawers with them;
* `map: null` takes the wood's picture off). A model's own <MeshStandardMaterial> children go first. */
export function Refinish({ materials, children }: { materials: MeshStandardMaterialProps[]; children?: ReactNode }) {
export function Refinish({ materials, children }: RefinishProps) {
if (!Array.isArray(materials) || materials.length === 0) throw new TypeError("Refinish: materials is a list of MeshStandardMaterial props ([{ color: \"#8a9a7b\", map: null }])");
const specs = materials.map((m) => {
checkMaterial("Refinish", m as Record<string, unknown>);
@@ -133,6 +143,7 @@ export function Group(props: GroupProps) {
export interface ModelProps {
/** a glTF file in the media folder: staticFile("models/shoe.glb") */
src: string;
/** the entity's name, for picking and the inspector */
name?: string;
/** how its own glTF textures are read (docs/shaders.feature SH5): { filter: "nearest" } for hard pixels, whatever
* the file says; a <MeshStandardMaterial> child's maps take their own `sampler` */
@@ -155,9 +166,11 @@ export interface ModelProps {
* a ragdoll's bodies move one skin that bends at its joints rather than rigid pieces. The model's own placement
* stays at the origin. */
bones?: Record<string, string>;
/** where it stands, metres (x, y, z) */
position?: Vec3;
/** radians */
rotation?: Vec3;
/** one number, or x, y and z */
scale?: number | Vec3;
/** it may pass through other parts on purpose (a blade into a body, a ghost through a wall): raea's clipping
* check leaves it out */
@@ -195,6 +208,7 @@ export interface ModelProps {
morphs?: Record<string, number> | number[];
/** seconds into the clip (by default the Sequence's time: frame / fps); the clip loops unless loop={false} */
time?: number;
/** false plays the clip once and holds its last pose */
loop?: boolean;
/** which of the file's scenes (0 by default) */
scene?: number;
@@ -218,6 +232,7 @@ export interface ModelProps {
theme?: "dark" | "light";
/** the site look's ink: lift + light * gain, before the dither (0.28 and 0.9 by default; on the light greys light is inverted, 0.35 and 0.75) */
lift?: number;
/** the site look's ink gain: lift + light * gain (0.9 by default, 0.75 on the light greys) */
gain?: number;
/** <MeshToonMaterial> children: toon surfaces over the model's own materials (all of them, or one each by name);
* <MeshStandardMaterial> children: its materials (all, or one each by `material`) given the colour, texture or
@@ -347,13 +362,17 @@ export function Model(props: ModelProps) {
export interface ImagePlaneProps {
/** a picture in the media folder: staticFile("poster.png") */
src: string;
/** the entity's name, for picking and the inspector */
name?: string;
/** width in scene units (1 by default); height follows the picture unless given */
width?: number;
/** in scene units (follows the picture's shape by default) */
height?: number;
/** where its centre stands, metres (x, y, z) */
position?: Vec3;
/** radians */
rotation?: Vec3;
/** one number, or x, y and z */
scale?: number | Vec3;
/** a turn as a quaternion [x, y, z, w], instead of `rotation` (a card turned to face a point) */
quaternion?: [number, number, number, number];
+12 -1
View File
@@ -4,17 +4,27 @@ import { BevyComponent, Entity } from "./all";
import { assetPath } from "./materials";
/** A vertex attribute: Bevy's VertexFormat by name, its byte offset in a vertex and its shader @location. */
export interface PhaseAttribute { format: "Float32" | "Float32x2" | "Float32x3" | "Float32x4" | "Uint32" | "Uint32x2" | "Uint32x3" | "Uint32x4" | "Sint32" | "Sint32x2" | "Sint32x3" | "Sint32x4" | "Unorm8x4"; offset: number; location: number }
export interface PhaseAttribute {
/** the attribute's VertexFormat, by name */
format: "Float32" | "Float32x2" | "Float32x3" | "Float32x4" | "Uint32" | "Uint32x2" | "Uint32x3" | "Uint32x4" | "Sint32" | "Sint32x2" | "Sint32x3" | "Sint32x4" | "Unorm8x4";
/** its byte offset in a vertex */
offset: number;
/** its shader @location */
location: number;
}
export interface PhaseItemProps {
/** the shader file, compiled as written: staticFile("shaders/x.wesl") */
shader: string;
/** its entry points (Bevy's default names) */
vertex?: string;
/** the fragment entry point's name */
fragment?: string;
/** the vertex buffer: each vertex `stride` bytes, its 32-bit words in order (a u32 pad of 0 is a 0) */
stride: number;
/** the vertex buffer's attributes */
attributes: PhaseAttribute[];
/** the vertex buffer's 32-bit words, every vertex's in order */
words: number[];
/** the index buffer (u32), drawn whole */
indices: number[];
@@ -53,6 +63,7 @@ export interface MeshPassProps {
shader: string;
/** its entry points (Bevy's default names) */
vertex?: string;
/** the fragment entry point's name */
fragment?: string;
/** whether it tests and writes the view's depth (GreaterEqual), as a mesh in Bevy's opaque phase does (Bevy's
* shader_advanced/specialized_mesh_pipeline); without, it draws over everything */
+4
View File
@@ -84,7 +84,9 @@ export interface DepthOfFieldProps {
/** Bevy's fields, as Bevy's DepthOfField component on a Camera3d (inside it), Bevy's defaults: the distance in focus
* (10; the camera's `focus`), the f-number (1), the largest blur in pixels (64), "Bokeh" or "Gaussian" */
focal_distance?: number;
/** the f-number (1): lower is a shallower focus */
aperture_f_stops?: number;
/** the largest blur, in px (64) */
max_circle_of_confusion_diameter?: number;
}
@@ -160,6 +162,7 @@ export interface FisheyeProps extends LensCommon {
export interface LensDistortionProps extends LensCommon {
/** Brown-Conrady: r' = r (1 + k1 r^2 + k2 r^4), r a share of the half-diagonal. Above 0 barrel, below 0 pincushion */
k1?: number;
/** the r^4 term of the distortion */
k2?: number;
/** by default just enough for a barrel's corners to stay inside the picture (1 for pincushion) */
zoom?: number;
@@ -198,6 +201,7 @@ export interface MotionBlurProps {
shutterAngle?: number;
/** samples each way per pixel (4 by default) */
samples?: number;
/** declared animation of its numbers */
animate?: Animate3d;
}
+78 -12
View File
@@ -31,22 +31,54 @@ export function Canvas3D(props: Canvas3DProps) {
}
// Geometries. Each knows its Manifold expression; the defaults are unit sizes.
export interface BoxProps { args?: [number, number, number] }
export interface BoxProps {
/** width, height and depth in metres ([1, 1, 1]) */
args?: [number, number, number];
}
/** Bevy's Cuboid: half its size along each axis ([0.5, 0.5, 0.5], a 1 m cube, as Bevy's default). */
export interface CuboidProps { half_size?: [number, number, number] }
export interface CuboidProps {
/** half its size along x, y and z, metres ([0.5, 0.5, 0.5]) */
half_size?: [number, number, number];
}
/** `args`, or Bevy's Sphere field: radius (0.5 by Bevy's default). Its mesh is Bevy's Sphere::mesh(): an icosphere of 5
* subdivisions, or `ico` of them (Bevy's `.ico(n)`, 0 to 80), or a UV sphere of `uv` = [sectors, stacks] (`.uv(s, t)`). */
export interface SphereProps { args?: [number]; radius?: number; ico?: number; uv?: [number, number] }
export interface SphereProps {
/** [radius], as three.js's args */
args?: [number];
/** metres (0.5) */
radius?: number;
/** an icosphere of this many subdivisions (5 by default; 0 to 80) */
ico?: number;
/** a UV sphere instead: [sectors, stacks] */
uv?: [number, number];
}
export interface PlaneProps { args?: [number, number] }
export interface PlaneProps {
/** width and height in metres ([1, 1]) */
args?: [number, number];
}
/** `args`, or Bevy's Cylinder fields: radius and half_height (0.5 each by Bevy's default). */
export interface CylinderProps { args?: [number, number, number]; radius?: number; half_height?: number }
export interface CylinderProps {
/** [radius top, radius bottom, height], as three.js's args */
args?: [number, number, number];
/** metres (0.5) */
radius?: number;
/** half its height, metres (0.5) */
half_height?: number;
}
/** `args`, or Bevy's Torus fields: major_radius (0.75) and minor_radius (0.25), the tube's. */
export interface TorusProps { args?: [number, number]; major_radius?: number; minor_radius?: number }
export interface TorusProps {
/** [major radius, minor radius] */
args?: [number, number];
/** from the centre to the middle of the tube, metres (0.75) */
major_radius?: number;
/** the tube's radius, metres (0.25) */
minor_radius?: number;
}
const list = (ns: number[]) => ns.map((n) => String(n)).join(", ");
@@ -102,7 +134,7 @@ function geometry<P extends { args?: number[] }>(name: string, defaults: number[
export const Box = /* @__PURE__ */ geometry<BoxProps>("Box", [1, 1, 1], (a) => `box(${list(a)})`);
/** Bevy's Cuboid: `<Cuboid half_size={[1, 0.5, 1]} />` is a Box of args [2, 1, 2]. */
const CuboidShape = /* @__PURE__ */ geometry<CuboidProps & { args?: [number, number, number] }>("Box", [1, 1, 1], (a) => `box(${list(a)})`, { keys: ["half_size"], args: (p) => (p.half_size ?? [0.5, 0.5, 0.5]).map((h) => 2 * h) }, "Cuboid");
const CuboidShape = /* @__PURE__ */ geometry<CuboidProps & Pick<BoxProps, "args">>("Box", [1, 1, 1], (a) => `box(${list(a)})`, { keys: ["half_size"], args: (p) => (p.half_size ?? [0.5, 0.5, 0.5]).map((h) => 2 * h) }, "Cuboid");
/** Bevy's Cuboid::from_size: the fields for a cuboid of that whole size, `<Cuboid {...Cuboid.fromSize(size)} />`. */
function fromSize(size: [number, number, number]): Required<CuboidProps> {
@@ -135,7 +167,12 @@ export const Plane = /* @__PURE__ */ geometry<PlaneProps>("Plane", [1, 1], (a) =
/** Bevy's Plane3d: a flat rectangle facing `normal` (Bevy's default +Y, a floor), `half_size` its half extent along
* its two axes ([0.5, 0.5]), laid out as Bevy's PlaneMeshBuilder does: facing +Z it is a Plane of args
* [2 x half_size]. The normal is along an axis; a tilted plane is a rotated Mesh3d. */
export interface Plane3dProps { normal?: Vec3; half_size?: [number, number] }
export interface Plane3dProps {
/** the way it faces, along an axis (+Y by default, a floor) */
normal?: Vec3;
/** half its extent along its two axes, metres ([0.5, 0.5]) */
half_size?: [number, number];
}
// Bevy turns the +Y plane (half_size x along x, y along -z) to its normal by the shortest arc; along an axis that
// leaves its two sizes on these axes. Facing z it is the old Plane exactly; facing x or y a Box with no depth.
@@ -178,18 +215,37 @@ export const Cylinder = /* @__PURE__ */ geometry<CylinderProps>("Cylinder", [1,
/** Bevy's ConicalFrustum: a cylinder whose ends differ, radius_top and radius_bottom (Bevy's 0.25 and 0.5) and its
* height (0.5), standing up: a tapered Cylinder of args [radius_top, radius_bottom, height]. */
export interface ConicalFrustumProps { radius_top?: number; radius_bottom?: number; height?: number; args?: [number, number, number] }
export interface ConicalFrustumProps {
/** the top end's radius, metres (0.25) */
radius_top?: number;
/** the bottom end's radius, metres (0.5) */
radius_bottom?: number;
/** metres (0.5) */
height?: number;
/** [radius_top, radius_bottom, height] */
args?: [number, number, number];
}
export const ConicalFrustum = /* @__PURE__ */ geometry<ConicalFrustumProps>("Cylinder", [0.25, 0.5, 0.5], (a) => `rotate(cone(${list([a[1], a[0], a[2]])}), -90, 0, 0)`, { keys: ["radius_top", "radius_bottom", "height"], args: (p) => [p.radius_top ?? 0.25, p.radius_bottom ?? 0.5, p.height ?? 0.5] }, "ConicalFrustum");
export const Torus = /* @__PURE__ */ geometry<TorusProps>("Torus", [1, 0.4], (a) => `torus(${list(a)})`, { keys: ["major_radius", "minor_radius"], args: (p) => [p.major_radius ?? 0.75, p.minor_radius ?? 0.25] });
export interface ConeProps { args?: [number, number]; radius?: number; height?: number }
export interface ConeProps {
/** [radius, height] */
args?: [number, number];
/** the base's radius, metres (0.5) */
radius?: number;
/** metres (1) */
height?: number;
}
/** A cone: [radius, height], its point up (along y). */
export const Cone = /* @__PURE__ */ geometry<ConeProps>("Cone", [0.5, 1], (a) => `rotate(cone(${list([a[0], 0, a[1]])}), -90, 0, 0)`, { keys: ["radius", "height"], args: (p) => [p.radius ?? 0.5, p.height ?? 1] });
export interface CapsuleProps { args?: [number, number] }
export interface CapsuleProps {
/** [radius, length of the straight part] ([0.5, 1]) */
args?: [number, number];
}
/** A capsule (Bevy's Capsule3d, three.js's CapsuleGeometry): [radius, length of the straight part], standing up
* (along y); its whole height is length + 2 x radius. A character's stand-in, a pill, a collider's look.
@@ -197,7 +253,14 @@ export interface CapsuleProps { args?: [number, number] }
export const Capsule = /* @__PURE__ */ geometry<CapsuleProps>("Capsule", [0.5, 1], (a) => `hull(move(sphere(${a[0]}), 0, ${a[1] / 2}, 0), move(sphere(${a[0]}), 0, ${-a[1] / 2}, 0))`);
/** Bevy's Capsule3d: radius and half_length, the straight part's half (0.5 each by Bevy's default), standing up. */
export interface Capsule3dProps { radius?: number; half_length?: number; args?: [number, number] }
export interface Capsule3dProps {
/** metres (0.5) */
radius?: number;
/** half the straight part's length, metres (0.5) */
half_length?: number;
/** [radius, length of the straight part] */
args?: [number, number];
}
export const Capsule3d = /* @__PURE__ */ geometry<Capsule3dProps>("Capsule", [0.5, 1], (a) => `hull(move(sphere(${a[0]}), 0, ${a[1] / 2}, 0), move(sphere(${a[0]}), 0, ${-a[1] / 2}, 0))`, { keys: ["radius", "half_length"], args: (p) => [p.radius ?? 0.5, 2 * (p.half_length ?? 0.5)] }, "Capsule3d");
@@ -270,12 +333,15 @@ export function BufferMesh(props: BufferMeshProps) {
export interface Text3DProps {
/** the words, extruded */
children?: string;
/** the words, when they aren't its child (no quotes or backslashes) */
text?: string;
/** letter height in scene units (default 0.5) */
size?: number;
/** extrusion depth (default 0.2) */
depth?: number;
/** a family (Inter by default, or another of raea's bundled faces) */
font?: string;
/** 100..900 (800 by default) */
weight?: number;
}
+9
View File
@@ -8,8 +8,11 @@ import { usePointer2d, type Flat, type PointerHandlers3d } from "../events3d";
/** Where a 2D part is: composition px from the frame's top left, y down (as the page's), its centre there; and its
* pointer and drag handlers, called as a 3D part's are (2D parts are picked first, the top one by z). */
export interface Place2dProps extends PointerHandlers3d {
/** the entity's name, for picking, the inspector and world.* */
name?: string;
/** px from the frame's left edge to the part's centre */
x?: number;
/** px from the frame's top edge to the part's centre, down positive */
y?: number;
/** radians, clockwise (as CSS rotate) */
rotation?: number;
@@ -30,6 +33,7 @@ export interface SpriteProps extends Place2dProps {
src: string;
/** size in px (the picture's, or one cell's, by default); one given, the other follows the picture's shape */
width?: number;
/** in px; given alone, the width follows the picture's shape */
height?: number;
/** a sprite sheet: the picture is `[columns, rows]` cells of equal size, read left to right, top to bottom */
grid?: [number, number];
@@ -38,7 +42,9 @@ export interface SpriteProps extends Place2dProps {
atlasPick?: number;
/** with `grid`: which cell shows (0 is the top left); animate it to play the sheet: frame={Math.floor(f / 3)} */
frame?: number;
/** mirrored left to right */
flipX?: boolean;
/** mirrored top to bottom */
flipY?: boolean;
/** a tint multiplied over the picture (white by default) */
color?: string;
@@ -46,7 +52,9 @@ export interface SpriteProps extends Place2dProps {
* stretching to it, a tile every `tileStretch` x the picture's size (1 by default): a floor, a fence, a wall. Animate
* width and height to show more or fewer tiles */
tileX?: boolean;
/** tile the picture down its height instead of stretching it */
tileY?: boolean;
/** a tile every this many times the picture's size (1) */
tileStretch?: number;
/** Bevy's SpriteImageMode, as its reflected value: "Auto" (stretched to the size), { Scale: "FillCenter" } (and
* FillStart, FillEnd, FitCenter, FitStart, FitEnd: the picture kept to its shape, cropped or fitted), { Sliced:
@@ -127,6 +135,7 @@ export interface Shape2DProps extends Place2dProps {
shape?: "rect" | "circle" | "ellipse" | "triangle" | "polygon";
/** [width, height] in px ([100, 100] by default); a circle's and a polygon's diameter is the width */
size?: [number, number];
/** a polygon's number of sides (5) */
sides?: number;
/** a CSS colour (white by default); with a texture, it tints it */
color?: string;
+28
View File
@@ -8,13 +8,17 @@ import { Vec3, checkVec, node3d } from "./all";
// ---- text in the 3D world (docs/ts-native.feature P19) ----
export interface SpanProps {
/** the run's text */
children?: ReactNode;
/** a family (raea's bundled faces: Inter, Montserrat, Oswald, Playfair Display...; or one on this machine) */
font?: string;
/** 100..900 (the block's by default) */
weight?: number;
/** slanted (the block's by default) */
italic?: boolean;
/** times the block's size */
size?: number;
/** the run's colour (the block's by default) */
color?: string;
}
@@ -29,12 +33,15 @@ export interface GlyphInfo {
index: number;
/** how many glyphs the block has */
count: number;
/** the character it draws */
char: string;
/** its word's place among the words, from 0, and how many there are */
word: number;
/** how many words the block has */
words: number;
/** its place in its word, and the word's glyph count */
inWord: number;
/** how many glyphs its word has */
wordLength: number;
/** its line (by the newlines in the text), from 0 */
line: number;
@@ -49,9 +56,13 @@ export interface GlyphStyle {
position?: Vec3;
/** radians, XYZ */
rotation?: Vec3;
/** multiplies its size: one number, or x, y and z */
scale?: number | Vec3;
/** replaces its colour */
color?: string;
/** multiplies its opacity, 0..1 */
opacity?: number;
/** false hides it this frame */
visible?: boolean;
}
@@ -62,13 +73,19 @@ export interface RichTextProps {
* <Outline skip>, <Bloom skip>, <Grade skip>) leaves its pixels as drawn, and <Look passes> gives one its own paint;
* a piece names at most three passes besides "scene"; keyed per frame */
pass?: string;
/** where the block's origin is, metres (x, y, z) */
position?: Vec3;
/** the block's rotation, radians (x, y, z) */
rotation?: Vec3;
/** the block's scale: one number, or x, y and z */
scale?: number | Vec3;
/** the em in metres (0.5 by default) */
size?: number;
/** a family (raea's bundled faces: Inter by default, Montserrat, Oswald, Playfair Display...; or one on this machine) */
font?: string;
/** 100..900 (700 by default) */
weight?: number;
/** slanted (false by default) */
italic?: boolean;
/** each glyph's colour unless its <Span> gives one */
color?: string;
@@ -79,14 +96,21 @@ export interface RichTextProps {
lineHeight?: number;
/** wrapped at this width in metres (no wrapping by default) */
maxWidth?: number;
/** 0..1, smooth to matte */
roughness?: number;
/** 0..1, a dielectric to a metal */
metalness?: number;
/** the colour it glows with */
emissive?: string;
/** how strongly it glows (1 by default; 2-10 with bloom) */
emissiveIntensity?: number;
/** drawn in its flat colour, without light or shade */
unlit?: boolean;
/** letter-shaped shadows (true by default) */
castShadow?: boolean;
/** other things' shadows fall on it */
receiveShadow?: boolean;
/** the render layers it's on ([0] by default): a camera draws only the layers it's given */
layers?: number[];
/** each glyph's (or word's) entrance: a move's name, a move or several (rise, pop, slam, slide, fade... the 2D ones,
* their px read at 100 an em, their degrees as degrees), `each` frames apart from `at` */
@@ -95,8 +119,11 @@ export interface RichTextProps {
each?: number;
/** the entrance and exit staggered by letter (default) or by word */
by?: "letter" | "word";
/** the local frame the first entrance starts (0) */
at?: number;
/** each glyph's (or word's) exit: a move or its name, played backwards from `exitAt` */
exit?: MoveLike;
/** the local frame the first exit starts; an exit needs it */
exitAt?: number;
/** frames between exits (0: together) */
exitEach?: number;
@@ -104,6 +131,7 @@ export interface RichTextProps {
reveal?: number;
/** each glyph's own motion this frame, from anything the frame gives (useCurrentFrame, spring, interpolate) */
glyph?: (g: GlyphInfo) => GlyphStyle;
/** the text: strings and <Span> runs */
children?: ReactNode;
}
+6
View File
@@ -23,11 +23,17 @@ export interface ThreeShaderMaterialProps {
/** "display": its colour is what three's canvas shows (a ShaderMaterial's); "linear": scene light, tone-mapped as
* the rest of the frame is (a node material's) */
output?: "display" | "linear";
/** blended over what's behind it, as three's \`transparent\` */
transparent?: boolean;
/** how it blends: normal, additive (add), multiply or none */
blending?: "normal" | "additive" | "add" | "multiply" | "none";
/** which faces draw: front, back or double */
side?: "front" | "back" | "double";
/** it writes the depth buffer */
depthWrite?: boolean;
/** it's hidden behind what's nearer */
depthTest?: boolean;
/** pixels less opaque than this are dropped */
alphaTest?: number;
/** three's clock this frame: [seconds, delta, frame] */
time?: [number, number, number];
+102
View File
@@ -0,0 +1,102 @@
// Volumetric fog: light in the air, drawn inside every <FogVolume>.
import { Vec3, assetPath, checkVec, colours, node3d } from "./all";
export interface VolumetricFogProps {
/** mode="march": samples along each ray through a fog volume (64 by default): too few stair-step a shaft's edges, so 128 for a
* render with hard-edged shafts, or 32 with `dither`; about 0.1 ms a step at 1920x1080 on an M5 Pro */
steps?: number;
/** mode="march": start each pixel's march a fraction of a step in, by a fixed noise seeded from the pixel and the frame number
* (false by default): the shafts' steps become fine grain instead of bands, so fewer steps look smooth. The noise
* is a function of the frame, so a render still equals its play */
dither?: boolean;
/** mode="march": the fraction of the frame's resolution the fog is marched at (1 by default): 0.5 marches a quarter of the
* pixels and puts the result over the frame guided by depth, so an edge in front of a shaft keeps no fog from
* what's behind it. 0.5, 1/3 or 0.25; each frame on its own, so a render still equals its play */
resolution?: number;
/** light the fog has everywhere, lit or not (0 by default). Bevy lights a volume's whole box with it whatever its
* density, so the box's edges show: keep it 0, or small with the camera inside the volume */
ambient?: number;
/** that light's colour (white by default) */
ambientColor?: string;
/** how the fog is drawn: "froxel" (the default: every volume written into one grid of cells along the view, lit
* once a cell and integrated front to back once, with the `hero` lights' shafts integrated exactly along epipolar lines: no
* steps, no dither, its cost the grid's whatever the resolution or the number of volumes, overlapping volumes mixed
* as one medium, see-through surfaces fogged at their own depth) or "march" (Bevy's ray march through each
* volume, as before). `steps`, `dither` and `resolution` are the march's; `slices`, `tile`, `samples` and `hero`
* the grid's */
mode?: "march" | "froxel";
/** the grid's cells along the view, spaced evenly in log depth from the camera to the farthest volume (64 by
* default; 32 to 256) */
slices?: number;
/** the grid's cells across the frame, in pixels a side (16 by default; 4, 8 or 16) */
tile?: number;
/** points lit in each cell, spread along its depth (1 by default; 1 to 8): more keeps thin shadows in the
* grid's soft light (a hero light's shafts don't need them) */
samples?: number;
/** the grid's shafts: true (the default) integrates the first two volumetric spot lights and the first two
* volumetric directional lights exactly, over their shadow maps texel by texel, so a blind's bars or a doorway's
* edge are as crisp as the shadow map: integrated at samples along lines from the light across the frame (Chen et
* al.'s epipolar sampling), more of them where the depth or the light changes, and each pixel read from the
* samples either side of it at its depth; false lights them in the grid's cells with the rest */
hero?: boolean;
}
/** Volumetric fog on the camera: light in the air, drawn inside every <FogVolume>, with shafts from the lights marked
* `volumetric`. Put it inside the Canvas3D, once; without it fog volumes draw nothing.
* @bevy bevy_light::volumetric::VolumetricFog
* @bevy bevy_light::volumetric::VolumetricLight */
export function VolumetricFog(props: VolumetricFogProps) {
if (props.steps !== undefined && !(Number.isInteger(props.steps) && props.steps >= 1 && props.steps <= 256)) throw new RangeError(`VolumetricFog: steps must be a whole number from 1 to 256, got ${props.steps}`);
if (props.dither !== undefined && typeof props.dither !== "boolean") throw new TypeError(`VolumetricFog: dither must be true or false, got ${JSON.stringify(props.dither)}`);
if (props.resolution !== undefined && !(props.resolution > 0 && props.resolution <= 1 && [1, 2, 3, 4].some((k) => Math.abs(props.resolution! * k - 1) < 1e-6))) throw new RangeError(`VolumetricFog: resolution must be 1, 0.5, 1/3 or 0.25, got ${props.resolution}`);
if (props.ambient !== undefined && !(props.ambient >= 0)) throw new RangeError(`VolumetricFog: ambient must be 0 or more, got ${props.ambient}`);
if (props.mode !== undefined && !["march", "froxel"].includes(props.mode)) throw new RangeError(`VolumetricFog: mode must be "march" or "froxel", got ${JSON.stringify(props.mode)}`);
if (props.slices !== undefined && !(Number.isInteger(props.slices) && props.slices >= 32 && props.slices <= 256)) throw new RangeError(`VolumetricFog: slices must be a whole number from 32 to 256, got ${props.slices}`);
if (props.tile !== undefined && ![4, 8, 16].includes(props.tile)) throw new RangeError(`VolumetricFog: tile must be 4, 8 or 16, got ${props.tile}`);
if (props.samples !== undefined && !(Number.isInteger(props.samples) && props.samples >= 1 && props.samples <= 8)) throw new RangeError(`VolumetricFog: samples must be a whole number from 1 to 8, got ${props.samples}`);
return node3d("VolumetricFog", colours("VolumetricFog", props as Record<string, unknown>, ["ambientColor"]));
}
export interface FogVolumeProps {
/** parts are matched by name across frames: name a volume that comes and goes */
name?: string;
/** the box's centre */
position?: Vec3;
/** radians */
rotation?: Vec3;
/** the box's size in metres: one number for a cube, or [x, y, z] (1 by default) */
scale?: number | Vec3;
/** how thick the air is (0.1 by default: dusty; 0.02 a faint haze; 0.5 smoke). Animate it to let dust settle,
* smoke roll in or a volume vanish (0) */
density?: number;
/** the fog's own colour, what light scattering out of it takes on (white by default; a dark red for blood in the
* air) */
color?: string;
/** how much light it swallows (0.3 by default): higher reads as soot or smoke */
absorption?: number;
/** how much light it throws back toward the eye (0.3 by default): higher reads as bright dust or mist */
scattering?: number;
/** how far forward it scatters, -1 to 1 (0.5 by default): near 1 the shafts glow when you look toward the light */
anisotropy?: number;
/** how fast it thins going up, per metre from the box's floor (0 by default: even throughout): 0.5 is a ground
* fog that's a third as thick two metres up. A box wide and tall with a falloff is height fog. Only
* <VolumetricFog mode="froxel"> draws it; the march draws the box evenly */
falloff?: number;
/** Bevy's density_texture: a 3D .ktx2 image in the media folder whose values scale the density through the box (a
* cloud, a bunny of smoke); the box draws evenly without one. Only the march draws it */
density_texture?: string;
}
/** A box of air that light shows in: dust in a sunbeam, smoke, a haze of blood. Needs a <VolumetricFog> in the
* Canvas3D; lights marked `volumetric` throw shafts through it, and every light's glow fills it softly. A part, so it
* keeps its name across frames: animate its density, colour and placement.
* @bevy bevy_light::volumetric::FogVolume */
export function FogVolume(props: FogVolumeProps) {
for (const k of ["position", "rotation"] as const) if (props[k] !== undefined) checkVec("FogVolume", k, props[k]);
if (props.density !== undefined && !(props.density >= 0 && Number.isFinite(props.density))) throw new RangeError(`FogVolume: density must be 0 or more, got ${props.density}`);
if (props.anisotropy !== undefined && !(props.anisotropy > -1 && props.anisotropy < 1)) throw new RangeError(`FogVolume: anisotropy must be between -1 and 1, got ${props.anisotropy}`);
const tex = props.density_texture;
if (tex !== undefined && !(typeof tex === "string" && /\.ktx2$/i.test(tex))) throw new TypeError(`FogVolume: density_texture is a 3D .ktx2 image, got ${JSON.stringify(tex)}`);
if (props.falloff !== undefined && !(props.falloff >= 0 && Number.isFinite(props.falloff))) throw new RangeError(`FogVolume: falloff must be 0 or more, got ${props.falloff}`);
return node3d("FogVolume", colours("FogVolume", (tex === undefined ? props : { ...props, density_texture: assetPath(tex) }) as Record<string, unknown>, ["color"]));
}
+2 -1
View File
@@ -28,7 +28,8 @@ export { Hdr } from "./bevy3d/core";
// Lightmap (bevy_pbr::lightmap): a bake on a <Model>'s glTF meshes by name (docs/control.feature FC0a)
export { Lightmap, type LightmapProps } from "./bevy3d/lightmap";
// bevy_ui's Node, Text and TextSpan, and their values, drawn by the page
export { Node, GhostNode, Text, TextSpan, TextShadow, Text2d, UiScale, Viewport, UiTargetCamera, FontVariationTag, type NodeProps, type TextProps, type TextStyleProps, type TextRunProps, type Text2dProps } from "./bevy3d/ui";
export { Node, GhostNode, Text, TextSpan, TextShadow, Text2d, FontVariationTag, type NodeProps, type TextProps, type TextStyleProps, type TextRunProps, type Text2dProps } from "./bevy3d/ui";
export { UiScale, Viewport, UiTargetCamera, type UiScaleProps, type ViewportProps, type UiTargetCameraProps } from "./bevy3d/ui-roots";
export { UiTexture, targetImage } from "./bevy3d/ui-texture";
export { EditableText, type EditableTextProps, type TextCursorStyle } from "./bevy3d/ui-edit";
export { ImageNode, InlineImage, ImagePlugin, TextureAtlasLayout, type TextureSlicer, type SliceScaleMode, type ImageNodeProps } from "./bevy3d/ui-image";
+1
View File
@@ -3,6 +3,7 @@
export * from "./core";
export * from "./colors";
export * from "./procedural";
export * from "./extensions";
export * from "./materials";
export * from "./material";
export * from "./lights";
+6 -2
View File
@@ -11,9 +11,10 @@ const srgbToLinear = (c: number) => (c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.
const linearToSrgb = (c: number) => (c <= 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 1 / 2.4) - 0.055);
/** Bevy's Srgba: gamma-encoded colour, each channel 0..1. */
/** Bevy's Srgba: gamma-encoded colour, each channel 0..1. @bevy bevy_color::srgba::Srgba */
export class Srgba {
[MADE_FROM]?: MadeFrom;
/** sRGB red, green, blue and alpha, each 0 to 1. */
constructor(public red: number, public green: number, public blue: number, public alpha = 1) {}
/** Bevy's Srgba::hex: rgb, rgba, rrggbb or rrggbbaa (the # optional), and also rgb() or a common name */
static hex(hex: string): Srgba {
@@ -41,6 +42,7 @@ export class Srgba {
lighter(amount: number): Srgba {
return LinearRgba.from(this).lighter(amount).to_srgba();
}
/** The same colour with this alpha. */
with_alpha(alpha: number): Srgba {
const s = new Srgba(this.red, this.green, this.blue, alpha);
s[MADE_FROM] = this[MADE_FROM];
@@ -68,10 +70,12 @@ export function baseOf(c: string | Srgba | undefined): { color: string; alpha: n
return { color: "#" + byte(c.red) + byte(c.green) + byte(c.blue), alpha: c.alpha };
}
/** Bevy's LinearRgba: linear light, which a StandardMaterial's emissive is; a channel past 1 is brighter than white. */
/** Bevy's LinearRgba: linear light, which a StandardMaterial's emissive is; a channel past 1 is brighter than white. @bevy bevy_color::linear_rgba::LinearRgba */
export class LinearRgba {
[MADE_FROM]?: MadeFrom;
/** Linear red, green, blue (above 1 for brighter than white) and alpha. */
constructor(public red: number, public green: number, public blue: number, public alpha = 1) {}
/** An opaque linear colour. */
static rgb(red: number, green: number, blue: number): LinearRgba {
return new LinearRgba(red, green, blue);
}
+24 -4
View File
@@ -12,9 +12,11 @@ type Rgb = LinearRgba | Srgba;
const linearOf = (c: Rgb): LinearRgba => (c instanceof LinearRgba ? c : LinearRgba.from(c));
const srgbaOf = (c: Rgb): Srgba => (c instanceof Srgba ? c : c.to_srgba());
/** Bevy's Oklaba: perceptual lightness and two opponent axes. */
/** Bevy's Oklaba: perceptual lightness and two opponent axes. @bevy bevy_color::oklaba::Oklaba */
export class Oklaba {
/** Perceptual lightness, a (green to red), b (blue to yellow) and alpha. */
constructor(public lightness: number, public a: number, public b: number, public alpha = 1) {}
/** The same colour from an Srgba, LinearRgba or Oklcha. */
static from(c: Rgb | Oklcha): Oklaba {
if (c instanceof Oklcha) {
const h = f((c.hue * Math.PI) / 180);
@@ -26,6 +28,7 @@ export class Oklaba {
const s = f(Math.cbrt(f(f(f(0.08830246 * r) + f(0.28171885 * g)) + f(0.6299787 * b))));
return new Oklaba(f(f(f(0.21045426 * l) + f(0.7936178 * m)) - f(0.004072047 * s)), f(f(f(1.9779985 * l) - f(2.4285922 * m)) + f(0.4505937 * s)), f(f(f(0.025904037 * l) + f(0.78277177 * m)) - f(0.80867577 * s)), alpha);
}
/** The same colour as a LinearRgba. */
to_linear(): LinearRgba {
const { lightness: L, a, b } = this;
const l = f(f(L + f(0.39633778 * a)) + f(0.21580376 * b)) ** 3;
@@ -33,28 +36,35 @@ export class Oklaba {
const s = f(f(L - f(0.08948418 * a)) - f(1.2914855 * b)) ** 3;
return new LinearRgba(f(4.0767417 * l - 3.3077116 * m + 0.23096994 * s), f(-1.268438 * l + 2.6097574 * m - 0.34131938 * s), f(-0.0041960863 * l - 0.7034186 * m + 1.7076147 * s), this.alpha);
}
/** The same colour as an Srgba. */
to_srgba(): Srgba {
return this.to_linear().to_srgba();
}
/** The colour `t` (0 to 1) of the way to `o`, mixed in this space. */
mix(o: Oklaba, t: number): Oklaba {
return new Oklaba(lerp(this.lightness, o.lightness, t), lerp(this.a, o.a, t), lerp(this.b, o.b, t), lerp(this.alpha, o.alpha, t));
}
}
/** Bevy's Oklcha: Oklab's lightness, chroma and hue (degrees). */
/** Bevy's Oklcha: Oklab's lightness, chroma and hue (degrees). @bevy bevy_color::oklcha::Oklcha */
export class Oklcha {
/** Perceptual lightness, chroma, hue in degrees and alpha. */
constructor(public lightness: number, public chroma: number, public hue: number, public alpha = 1) {}
/** The same colour from an Srgba, LinearRgba or Oklaba. */
static from(c: Rgb | Oklaba): Oklcha {
const o = c instanceof Oklaba ? c : Oklaba.from(c);
const hue = f((Math.atan2(o.b, o.a) * 180) / Math.PI);
return new Oklcha(o.lightness, f(Math.hypot(o.a, o.b)), hue < 0 ? f(hue + 360) : hue, o.alpha);
}
/** The same colour as a LinearRgba. */
to_linear(): LinearRgba {
return Oklaba.from(this).to_linear();
}
/** The same colour as an Srgba. */
to_srgba(): Srgba {
return this.to_linear().to_srgba();
}
/** The colour `t` (0 to 1) of the way to `o`, mixed in this space. */
mix(o: Oklcha, t: number): Oklcha {
return new Oklcha(lerp(this.lightness, o.lightness, t), lerp(this.chroma, o.chroma, t), lerpHue(this.hue, o.hue, t), lerp(this.alpha, o.alpha, t));
}
@@ -72,28 +82,35 @@ export class Oklcha {
}
}
/** Bevy's Xyza: CIE 1931 XYZ (D65, as linear sRGB's). */
/** Bevy's Xyza: CIE 1931 XYZ (D65, as linear sRGB's). @bevy bevy_color::xyza::Xyza */
export class Xyza {
/** CIE XYZ (D65) and alpha. */
constructor(public x: number, public y: number, public z: number, public alpha = 1) {}
/** The same colour from an Srgba or LinearRgba. */
static from(c: Rgb): Xyza {
const { red: r, green: g, blue: b, alpha } = linearOf(c);
return new Xyza(f(r * 0.4124564 + g * 0.3575761 + b * 0.1804375), f(r * 0.2126729 + g * 0.7151522 + b * 0.072175), f(r * 0.0193339 + g * 0.119192 + b * 0.9503041), alpha);
}
/** The same colour as a LinearRgba. */
to_linear(): LinearRgba {
const { x, y, z } = this;
return new LinearRgba(f(x * 3.2404542 + y * -1.5371385 + z * -0.4985314), f(x * -0.969266 + y * 1.8760108 + z * 0.041556), f(x * 0.0556434 + y * -0.2040259 + z * 1.0572252), this.alpha);
}
/** The same colour as an Srgba. */
to_srgba(): Srgba {
return this.to_linear().to_srgba();
}
/** The colour `t` (0 to 1) of the way to `o`, mixed in this space. */
mix(o: Xyza, t: number): Xyza {
return new Xyza(lerp(this.x, o.x, t), lerp(this.y, o.y, t), lerp(this.z, o.z, t), lerp(this.alpha, o.alpha, t));
}
}
/** Bevy's Hsla: hue (degrees), saturation and lightness, each 0..1; converted through Hsva and Hwba, as Bevy's is. */
/** Bevy's Hsla: hue (degrees), saturation and lightness, each 0..1; converted through Hsva and Hwba, as Bevy's is. @bevy bevy_color::hsla::Hsla */
export class Hsla {
/** Hue in degrees (0 to 360), saturation, lightness and alpha 0 to 1. */
constructor(public hue: number, public saturation: number, public lightness: number, public alpha = 1) {}
/** The same colour from an Srgba or LinearRgba. */
static from(c: Rgb): Hsla {
const { red, green, blue, alpha } = srgbaOf(c);
// Srgba -> Hwba
@@ -109,6 +126,7 @@ export class Hsla {
const l = f(v * f(1 - f(s / 2)));
return new Hsla(hue, l === 0 || l === 1 ? 0 : f(f(v - l) / Math.min(l, f(1 - l))), l, alpha);
}
/** The same colour as an Srgba. */
to_srgba(): Srgba {
const { hue, saturation: s0, lightness: l } = this;
// Hsla -> Hsva -> Hwba
@@ -123,9 +141,11 @@ export class Hsla {
const rgb: [number, number, number] = [[v, n, w], [n, v, w], [w, v, n], [w, n, v], [n, w, v], [v, w, n]][i] as [number, number, number];
return new Srgba(rgb[0], rgb[1], rgb[2], this.alpha);
}
/** The same colour as a LinearRgba. */
to_linear(): LinearRgba {
return LinearRgba.from(this.to_srgba());
}
/** The colour `t` (0 to 1) of the way to `o`, mixed in this space. */
mix(o: Hsla, t: number): Hsla {
return new Hsla(lerpHue(this.hue, o.hue, t), lerp(this.saturation, o.saturation, t), lerp(this.lightness, o.lightness, t), lerp(this.alpha, o.alpha, t));
}
+14
View File
@@ -123,16 +123,23 @@ function lookingAt(eye: Vec3, target: Vec3, up: Vec3): Quat {
/** A Transform's value, as Bevy reflects it. */
export interface TransformValue {
/** where it is, metres (x, y, z) */
translation?: Vec3;
/** its rotation as a quaternion [x, y, z, w] */
rotation?: Quat;
/** its scale along x, y and z */
scale?: Vec3;
}
/** A Transform built with Bevy's builders: each returns a new one. */
export interface TransformBuilt extends Required<TransformValue> {
/** the same transform, moved to `v` */
withTranslation(v: Vec3): TransformBuilt;
/** the same transform, turned to `q` */
withRotation(q: Quat): TransformBuilt;
/** the same transform, scaled to `s` (one number for all three axes) */
withScale(s: Vec3 | number): TransformBuilt;
/** the same transform, turned so its -Z faces `target` with `up` (+Y) up, as Bevy's looking_at */
lookingAt(target: Vec3, up?: Vec3): TransformBuilt;
}
@@ -170,9 +177,11 @@ function place(t: TransformValue | undefined, animated = false): Pick<MeshProps,
}
export interface Mesh3dProps extends Omit<MeshProps, "position" | "rotation" | "scale"> {
/** where it stands: translation, rotation (a quaternion) and scale, as Bevy's Transform */
transform?: TransformValue;
/** Bevy's Visibility: "Hidden" draws nothing; "Visible" and "Inherited" draw */
visibility?: "Visible" | "Hidden" | "Inherited";
/** its material and child entities */
children?: ReactNode;
}
@@ -205,7 +214,9 @@ export type Projection =
| { Orthographic: { near?: number; far?: number; scaling_mode?: { FixedVertical: { viewport_height: number } } } };
export interface Camera3dProps {
/** where the camera stands and faces (`Transform.fromXYZ(...).lookingAt(...)`) */
transform?: TransformValue;
/** perspective (the default) or orthographic, as Bevy's Projection */
projection?: Projection;
/** Bevy's RenderLayers on the camera: it draws only the parts on these layers (a Mesh3d's `layers`; [0] by default) */
layers?: number[];
@@ -217,12 +228,15 @@ export interface Camera3dProps {
/** Bevy's Viewport: the camera draws into this region of the window only, `physical_position` from its top left and
* `physical_size` big (whole px, at a scale factor of 1) */
viewport?: CameraViewport;
/** components on the camera: post effects, tone mapping, a skybox */
children?: ReactNode;
}
/** Bevy's Viewport on a Camera, its depth range Bevy's default 0..1. */
export interface CameraViewport {
/** the viewport's top-left corner, in px */
physical_position: [number, number];
/** the viewport's width and height, in px */
physical_size: [number, number];
}
+142
View File
@@ -0,0 +1,142 @@
// raea's MaterialExtensions over a StandardMaterial: grid, paint, wear, shader and toon, each an ExtendedMaterial's
// `extension` (materials.tsx turns them into the old material's props).
import type { ReactNode } from "react";
import type { TrackSpec } from "@raea/math/animate";
import type { SurfaceShaderSpec, ToonBand, ToonHighlight, ToonOutline, ToonRim } from "../3d";
import type { MeshStandardMaterialProps } from "../three";
// A fixes an `animate` to the fields T names: any other key is never, so a typo fails in tsc, not at render
export type Only<A, T> = { [K in keyof A]: K extends keyof T ? T[K] : never };
/** raea's extension of StandardMaterial (a Bevy MaterialExtension of raea's): graph paper over the surface for
* greybox levels, lines every `cell` world units (fixed in the world, so they run on across shapes), a heavier one
* every `major` cells (4), in `color`, and each face of a Box outlined in `edge` ("" for no outlines). Its colours are
* the first frame's. It goes in an ExtendedMaterial's `extension`. */
export interface GridExtensionProps {
/** world units between grid lines */
cell: number;
/** cells between heavier lines (4) */
major?: number;
/** the lines' colour */
color?: string;
/** the colour each Box face is outlined in ("" for none) */
edge?: string;
}
/** raea's grid over a StandardMaterial, as an ExtendedMaterial's extension (engine/render grid.rs):
* @bevy bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_render::engine::grid::Grid>> */
export function GridExtension(_: GridExtensionProps): ReactNode {
throw new TypeError("GridExtension goes in an ExtendedMaterial: <ExtendedMaterial base={<StandardMaterial />} extension={<GridExtension cell={0.5} />} />");
}
/** raea's extension of StandardMaterial for a paint look (<Look mode="paint">): the surface broken up by world-space
* noise of `scale` metres (1), its tone boundaries wandering by `breakup` (0.5) and patches of it taking `color`
* (`amount`, 0.6, of the way): a mottled field, rust, a wall's uneven paint. It goes in an ExtendedMaterial's
* `extension`. */
export interface PaintExtensionProps {
/** how far tone boundaries wander (0.5) */
breakup?: number;
/** the noise's size in metres (1) */
scale?: number;
/** the colour patches take */
color?: string;
/** how far toward `color` the patches go (0.6) */
amount?: number;
}
export function PaintExtension(_: PaintExtensionProps): ReactNode {
throw new TypeError("PaintExtension goes in an ExtendedMaterial: <ExtendedMaterial base={<StandardMaterial />} extension={<PaintExtension scale={0.5} />} />");
}
/** raea's extension of StandardMaterial that wears it (the engine's Wear MaterialExtension, systems/wear): its paint
* mottled, chipped back to `chip_color` on edges and a few spots, `grime` gathered low and underneath and `rust` run
* down in streaks, fixed in the part's own space as it moves. `amount` 0-1; `chips`, `grime` and `rust` each 0-1 of it
* (0.6, 0.5, 0.25); `scale` a blotch's size in metres (0.08); `seed` moves the pattern. It goes in an
* ExtendedMaterial's `extension`. */
export interface WearExtensionProps {
/** how worn it is, 0-1 */
amount: number;
/** a blotch's size in metres (0.08) */
scale?: number;
/** chips on edges and a few spots, 0-1 of the wear (0.6) */
chips?: number;
/** grime low and underneath, 0-1 of the wear (0.5) */
grime?: number;
/** rust run down in streaks, 0-1 of the wear (0.25) */
rust?: number;
/** moves the pattern */
seed?: number;
/** what chips show beneath the paint */
chip_color?: string;
/** the grime's colour */
grime_color?: string;
/** the rust's colour */
rust_color?: string;
}
/** raea's chips, grime and rust over a StandardMaterial, as an ExtendedMaterial's extension (systems/wear):
* @bevy bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>> */
export function WearExtension(_: WearExtensionProps): ReactNode {
throw new TypeError("WearExtension goes in an ExtendedMaterial: <ExtendedMaterial base={<StandardMaterial />} extension={<WearExtension amount={0.6} />} />");
}
// the old material's `wear` from WearExtension's fields (its colours camelCase there)
export function wearOf(w: WearExtensionProps): MeshStandardMaterialProps["wear"] {
const { chip_color, grime_color, rust_color, ...rest } = w;
return { ...rest, ...(chip_color !== undefined ? { chipColor: chip_color } : {}), ...(grime_color !== undefined ? { grimeColor: grime_color } : {}), ...(rust_color !== undefined ? { rustColor: rust_color } : {}) };
}
/** raea's extension of StandardMaterial written in WESL (the engine's ShaderExt, docs/shaders.feature SH1): its
* `fn surface` runs before Bevy's lighting and its `fn lit` after it, on the base's inputs, so the surface stays lit
* and shadowed. raea/3d's <MeshStandardMaterial shader> is the same thing; the spec is SurfaceShaderSpec. It goes in an
* ExtendedMaterial's `extension`, alone.
* @bevy bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_shader::ShaderExt> */
export type ShaderExtensionProps = SurfaceShaderSpec;
export function ShaderExtension(_: ShaderExtensionProps): ReactNode {
throw new TypeError("ShaderExtension goes in an ExtendedMaterial: <ExtendedMaterial base={<StandardMaterial />} extension={<ShaderExtension wesl={src} />} />");
}
/** raea's extension of StandardMaterial that cel-shades it (the engine's ToonExt; three.js's MeshToonMaterial): the
* scene's lights in `steps` hard bands (2; `bands` for an explicit ramp, darkest first), the bottom one
* `shadow_color` (the base colour darker, nudged towards violet), with an optional rim, highlight and ink outline
* (true for their defaults). Its base gives base_color, base_color_texture, emissive, alpha_mode and material; a
* toon surface has no roughness or metal. It goes in an ExtendedMaterial's `extension`, alone. */
export interface ToonExtensionProps {
/** how many hard bands the light falls into (2) */
steps?: number;
/** an explicit ramp of bands, darkest first, in place of `steps` */
bands?: ToonBand[];
/** the bottom band's colour (the base colour darker, nudged towards violet) */
shadow_color?: string;
/** a rim light on the silhouette: true for its default, or its settings */
rim?: boolean | ToonRim;
/** a hard specular highlight: true for its default, or its settings */
highlight?: boolean | ToonHighlight;
/** an ink outline: true for its default, or its settings */
outline?: boolean | ToonOutline;
/** how bright the rim is */
rim_intensity?: number;
/** how bright the highlight is */
highlight_intensity?: number;
/** the outline's width */
outline_width?: number;
/** its fields' tracks, as a StandardMaterial's `animate` (its base animates base_color and emissive) */
animate?: ToonExtensionAnimate;
}
export interface ToonExtensionAnimate {
/** a track of `shadow_color`, sampled each frame */
shadow_color?: TrackSpec<string>;
/** a track of `rim_intensity`, sampled each frame */
rim_intensity?: TrackSpec<number>;
/** a track of `highlight_intensity`, sampled each frame */
highlight_intensity?: TrackSpec<number>;
/** a track of `outline_width`, sampled each frame */
outline_width?: TrackSpec<number>;
}
export function ToonExtension<A>(_: ToonExtensionProps & { animate?: Only<A, ToonExtensionAnimate> }): ReactNode {
throw new TypeError("ToonExtension goes in an ExtendedMaterial: <ExtendedMaterial base={<StandardMaterial />} extension={<ToonExtension steps={3} />} />");
}
+2
View File
@@ -45,6 +45,7 @@ export interface FeathersColorSwatchProps extends Omit<NodeProps, "border_radius
color?: FeathersColor;
/** how much of its right side shows the colour opaque, in percent */
opaque_color_percentage?: number;
/** which corners are rounded */
corners?: RoundedCorners;
/** the corners' radius in px (5 by default), on the corners `corners` names */
border_radius?: number;
@@ -120,6 +121,7 @@ const THUMB_SIZE = SLIDER_HEIGHT - 2;
export interface FeathersColorSliderProps extends NodeProps {
/** SliderValue: the channel's value, in its range */
value?: number;
/** which colour channel it sets: Red, Green, Blue, Alpha, or HSL or Okhsl hue, saturation or lightness */
channel?: ColorChannel;
/** SliderBaseColor: the colour the track shows the channel of (white by default) */
base_color?: FeathersColor;
+6 -1
View File
@@ -66,10 +66,15 @@ export function FeathersButton({ variant = "Normal", corners = "All", disabled =
);
}
export interface VirtualKeyboardProps {
/** the keyboard's rows, each a row of key captions */
keys: string[][];
}
/** A grid of FeathersButtons, one row of keys a row (4 px apart both ways), each key's caption a plain Text (Bevy's
* default font, 20 px white: feathers' font reaches only a ThemedText), each key growing to share its row.
* VirtualKeyPressed fires on a key under input. @bevy bevy_feathers::controls::VirtualKeyboard */
export function VirtualKeyboard({ keys }: { keys: string[][] }) {
export function VirtualKeyboard({ keys }: VirtualKeyboardProps) {
if (!Array.isArray(keys) || !keys.every((r) => Array.isArray(r) && r.every((k) => typeof k === "string"))) throw new TypeError(`VirtualKeyboard: keys is rows of strings ([["Q", "W"], ["space"]]), got ${JSON.stringify(keys)}`);
return (
<Node flex_direction="Column" row_gap={px(4)}>
+24 -3
View File
@@ -42,18 +42,39 @@ function only(who: string, children: unknown): ReactElement<Record<string, unkno
return children as ReactElement<Record<string, unknown>>;
}
export interface ThemeBackgroundColorProps {
/** the theme colour's token */
token: ThemeToken;
/** the one element it colours */
children: ReactElement;
}
/** The element inside on the theme's colour for `token`. @bevy bevy_feathers::theme::ThemeBackgroundColor */
export function ThemeBackgroundColor({ token, children }: { token: ThemeToken; children: ReactElement }) {
export function ThemeBackgroundColor({ token, children }: ThemeBackgroundColorProps) {
return cloneElement(only("ThemeBackgroundColor", children), { background_color: useThemeColor(token) });
}
export interface ThemeBorderColorProps {
/** the theme colour's token */
token: ThemeToken;
/** the one element it borders */
children: ReactElement;
}
/** The element inside bordered in the theme's colour for `token`. @bevy bevy_feathers::theme::ThemeBorderColor */
export function ThemeBorderColor({ token, children }: { token: ThemeToken; children: ReactElement }) {
export function ThemeBorderColor({ token, children }: ThemeBorderColorProps) {
return cloneElement(only("ThemeBorderColor", children), { border_color: useThemeColor(token) });
}
export interface ThemeTextColorProps {
/** the theme colour's token */
token: ThemeToken;
/** the Text it colours */
children: ReactElement;
}
/** The Text inside in the theme's colour for `token`. @bevy bevy_feathers::theme::ThemeTextColor */
export function ThemeTextColor({ token, children }: { token: ThemeToken; children: ReactElement }) {
export function ThemeTextColor({ token, children }: ThemeTextColorProps) {
return cloneElement(only("ThemeTextColor", children), { color: useThemeColor(token) });
}
+8 -1
View File
@@ -3,7 +3,14 @@
// shape on transparency, which icon() tints with the text colour around it.
/** a feathers icon: its picture and size in px */
export interface FeathersIcon { image: string; width: number; height: number }
export interface FeathersIcon {
/** the icon's picture */
image: string;
/** in px */
width: number;
/** in px */
height: number;
}
/** bevy_feathers' icons. @bevy bevy_feathers::constants::icons */
export const icons = {
@@ -17,6 +17,7 @@ const GUTTER = 14;
export interface FeathersScrollbarProps extends NodeProps {
/** the Name of the Node it scrolls */
target: string;
/** which way it scrolls: Vertical or Horizontal */
orientation?: ControlOrientation;
/** hidden: the auto_hide decision, made by the list view (Bevy makes it after layout) */
hidden?: boolean;
@@ -122,7 +122,9 @@ export function display_value(kind: NumberKind, v: number): string {
/** formats a number input's value for display (or for editing). @bevy bevy_feathers::controls::UnitsFormat */
export interface UnitsFormat {
/** the format's name */
id: string;
/** the value as text: for display, or for editing when \`editing\` is true */
format(value: NumberInputValue, editing: boolean): string;
}
@@ -29,6 +29,7 @@ export function list_rows_from_strings(labels: string[], selected?: number): Rea
export interface FeathersSelectProps extends NodeProps {
/** its options: FeathersListRows, one of them selected (list_rows_from_strings) */
options: ReactNode;
/** which corners are rounded */
corners?: RoundedCorners;
/** the popup's most rows (8 by default) */
max_visible?: number;
@@ -16,6 +16,7 @@ export interface FeathersSliderProps extends NodeProps {
value?: number;
/** SliderRange's ends (0 to 1 by default) */
min?: number;
/** SliderRange's top end (1) */
max?: number;
/** SliderPrecision: decimal places shown (0 by default) */
precision?: number;
+16 -2
View File
@@ -18,15 +18,29 @@ const EMPTY: ThemeProps = { semantic_base: {}, semantic_overrides: {}, token_ass
const ThemeCx = createContext<ThemeProps>(EMPTY);
const LevelCx = createContext<SurfaceLevel>("Base");
export interface UiThemeProps {
/** the theme's colours by token */
theme: ThemeProps;
/** the widgets that use it */
children?: ReactNode;
}
/** Bevy's UiTheme resource: the theme every feathers widget inside looks its colours up in (create_dark_theme()).
* @bevy bevy_feathers::theme::UiTheme */
export function UiTheme({ theme, children }: { theme: ThemeProps; children?: ReactNode }) {
export function UiTheme({ theme, children }: UiThemeProps) {
return <ThemeCx.Provider value={theme}>{children}</ThemeCx.Provider>;
}
export interface ThemeContextProps {
/** the surface level they sit on */
level: SurfaceLevel;
/** the widgets on it */
children?: ReactNode;
}
/** the surface level the widgets inside sit on, which picks the theme's overrides for it.
* @bevy bevy_feathers::theme::ThemeContext */
export function ThemeContext({ level, children }: { level: SurfaceLevel; children?: ReactNode }) {
export function ThemeContext({ level, children }: ThemeContextProps) {
return <LevelCx.Provider value={level}>{children}</LevelCx.Provider>;
}
+3
View File
@@ -87,6 +87,7 @@ export interface DirectionalLightProps extends Omit<LightCommon, "children"> {
shadow_maps_enabled?: boolean;
/** soft shadows (PCSS): the sun's size as its shadows see it, in metres */
soft_shadow_size?: number | null;
/** Bevy components on the light: shadow settings, cascades */
children?: ReactNode;
}
@@ -101,7 +102,9 @@ export function DirectionalLight(p: DirectionalLightProps) {
}
export interface AmbientLightProps {
/** the entity's name, for picking, the inspector and world.* */
name?: string;
/** its colour, as CSS writes one (a name, hex, rgb()) */
color?: string;
/** cd/m² (Bevy's default 80) */
brightness?: number;
+2 -1
View File
@@ -1,5 +1,6 @@
// Your own Material (docs/control.feature FC2a): Bevy's Material, its shaders the author's files compiled as written.
import { ExtendedMaterial, ShaderExtension, StandardMaterial, type AlphaMode } from "./materials";
import { ShaderExtension } from "./extensions";
import { ExtendedMaterial, StandardMaterial, type AlphaMode } from "./materials";
import { surfaceShader, type SurfaceShaderSpec } from "../3d";
import type { StorageValue } from "../3d/materials";
import type { MeshVertexAttribute } from "../3d/attribute";
+29 -108
View File
@@ -1,16 +1,18 @@
// Materials: standard, grid, paint, toon, extended (their colours in colors.ts).
import { isValidElement, memo, useContext, type ReactElement, type ReactNode } from "react";
// Materials: standard, toon and extended (their colours in colors.ts, the extensions in extensions.tsx).
import { isValidElement, memo, useContext, type ReactElement } from "react";
import type { TrackSpec } from "@raea/math/animate";
import { InModel } from "../3d/all";
import { LinearRgba, MADE_FROM, baseOf, emissiveOf, type Affine2, type Srgba } from "./all";
import { samplerSpec, surfaceShader, type SamplerSpec, type SurfaceShaderSpec, type SurfaceDrawProps, type ToonBand, type ToonHighlight, type ToonOutline, type ToonRim } from "../3d";
import { LinearRgba, MADE_FROM, baseOf, emissiveOf, GridExtension, PaintExtension, WearExtension, ShaderExtension, ToonExtension, wearOf, type Affine2, type Srgba, type Only, type GridExtensionProps, type PaintExtensionProps, type WearExtensionProps, type ShaderExtensionProps, type ToonExtensionProps } from "./all";
import { samplerSpec, surfaceShader, type SamplerSpec, type SurfaceDrawProps } from "../3d";
import { MeshBasicMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, type MeshStandardMaterialProps } from "../three";
import { ProceduralExtension, proceduralOf, type ProceduralExtensionProps } from "./procedural";
/** A picture read with its own sampler: Bevy's load_with_settings, whose ImageLoaderSettings give the Image its
* ImageSamplerDescriptor ({ path: "checker.png", sampler: { filter: "nearest" } } for hard pixels). */
export interface SampledImage {
/** the picture, in the media folder */
path: string;
/** how it's sampled: filter, address modes */
sampler: SamplerSpec;
}
@@ -21,7 +23,9 @@ type Tex = string | SampledImage;
* its green, the metalness map's as its blue (white without one, so metallic is its factor exactly). Poly Haven's
* "_rough" sets come this way; a packed "_arm" map is a plain path. */
export interface MetallicRoughnessMaps {
/** a greyscale roughness map (white rough) */
roughness?: string;
/** a greyscale metalness map (white metal) */
metalness?: string;
}
@@ -91,27 +95,48 @@ export interface StandardMaterialProps {
/** The StandardMaterial fields `animate` takes, each a track of its own kind of value. An emissive brighter than white
* is LinearRgba keys of one colour: track({ 0: E.mul(0), 30: E.mul(2.5) }) with E = LinearRgba.from(Srgba.hex(c)). */
export interface StandardMaterialAnimate {
/** a track of `base_color`, sampled each frame */
base_color?: TrackSpec<string>;
/** a track of `emissive`, sampled each frame */
emissive?: TrackSpec<string> | TrackSpec<LinearRgba>;
/** a track of `perceptual_roughness`, sampled each frame */
perceptual_roughness?: TrackSpec<number>;
/** a track of `metallic`, sampled each frame */
metallic?: TrackSpec<number>;
// the rest of the fields that interpolate, each set on the part's own material frame by frame (docs/control.feature FC1c)
/** a track of `emissive_exposure_weight`, sampled each frame */
emissive_exposure_weight?: TrackSpec<number>;
/** a track of `reflectance`, sampled each frame */
reflectance?: TrackSpec<number>;
/** a track of `specular_tint`, sampled each frame */
specular_tint?: TrackSpec<string>;
/** a track of `diffuse_transmission`, sampled each frame */
diffuse_transmission?: TrackSpec<number>;
/** a track of `specular_transmission`, sampled each frame */
specular_transmission?: TrackSpec<number>;
/** a track of `thickness`, sampled each frame */
thickness?: TrackSpec<number>;
/** a track of `ior`, sampled each frame */
ior?: TrackSpec<number>;
/** a track of `attenuation_distance`, sampled each frame */
attenuation_distance?: TrackSpec<number>;
/** a track of `attenuation_color`, sampled each frame */
attenuation_color?: TrackSpec<string>;
/** a track of `clearcoat`, sampled each frame */
clearcoat?: TrackSpec<number>;
/** a track of `clearcoat_perceptual_roughness`, sampled each frame */
clearcoat_perceptual_roughness?: TrackSpec<number>;
/** a track of `anisotropy_strength`, sampled each frame */
anisotropy_strength?: TrackSpec<number>;
/** a track of `anisotropy_rotation`, sampled each frame */
anisotropy_rotation?: TrackSpec<number>;
/** a track of `depth_bias`, sampled each frame */
depth_bias?: TrackSpec<number>;
/** a track of `parallax_depth_scale`, sampled each frame */
parallax_depth_scale?: TrackSpec<number>;
/** a track of `max_parallax_layer_count`, sampled each frame */
max_parallax_layer_count?: TrackSpec<number>;
/** a track of `lightmap_exposure`, sampled each frame */
lightmap_exposure?: TrackSpec<number>;
}
@@ -123,8 +148,6 @@ const STANDARD_FIELDS: Record<string, "number" | "string"> = {
parallax_depth_scale: "number", max_parallax_layer_count: "number", lightmap_exposure: "number",
};
// A fixes an `animate` to the fields T names: any other key is never, so a typo fails in tsc, not at render
type Only<A, T> = { [K in keyof A]: K extends keyof T ? T[K] : never };
// each animatable field's name in the old material's animate
const STANDARD_ANIMATE: Record<string, string> = { base_color: "color", emissive: "emissive", perceptual_roughness: "roughness", metallic: "metalness" };
@@ -292,108 +315,6 @@ function standard(p: StandardMaterialProps, ext: Extended) {
);
}
/** raea's extension of StandardMaterial (a Bevy MaterialExtension of raea's): graph paper over the surface for
* greybox levels, lines every `cell` world units (fixed in the world, so they run on across shapes), a heavier one
* every `major` cells (4), in `color`, and each face of a Box outlined in `edge` ("" for no outlines). Its colours are
* the first frame's. It goes in an ExtendedMaterial's `extension`. */
export interface GridExtensionProps {
cell: number;
major?: number;
color?: string;
edge?: string;
}
/** raea's grid over a StandardMaterial, as an ExtendedMaterial's extension (engine/render grid.rs):
* @bevy bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_render::engine::grid::Grid>> */
export function GridExtension(_: GridExtensionProps): ReactNode {
throw new TypeError("GridExtension goes in an ExtendedMaterial: <ExtendedMaterial base={<StandardMaterial />} extension={<GridExtension cell={0.5} />} />");
}
/** raea's extension of StandardMaterial for a paint look (<Look mode="paint">): the surface broken up by world-space
* noise of `scale` metres (1), its tone boundaries wandering by `breakup` (0.5) and patches of it taking `color`
* (`amount`, 0.6, of the way): a mottled field, rust, a wall's uneven paint. It goes in an ExtendedMaterial's
* `extension`. */
export interface PaintExtensionProps {
breakup?: number;
scale?: number;
color?: string;
amount?: number;
}
export function PaintExtension(_: PaintExtensionProps): ReactNode {
throw new TypeError("PaintExtension goes in an ExtendedMaterial: <ExtendedMaterial base={<StandardMaterial />} extension={<PaintExtension scale={0.5} />} />");
}
/** raea's extension of StandardMaterial that wears it (the engine's Wear MaterialExtension, systems/wear): its paint
* mottled, chipped back to `chip_color` on edges and a few spots, `grime` gathered low and underneath and `rust` run
* down in streaks, fixed in the part's own space as it moves. `amount` 0-1; `chips`, `grime` and `rust` each 0-1 of it
* (0.6, 0.5, 0.25); `scale` a blotch's size in metres (0.08); `seed` moves the pattern. It goes in an
* ExtendedMaterial's `extension`. */
export interface WearExtensionProps {
amount: number;
scale?: number;
chips?: number;
grime?: number;
rust?: number;
seed?: number;
chip_color?: string;
grime_color?: string;
rust_color?: string;
}
/** raea's chips, grime and rust over a StandardMaterial, as an ExtendedMaterial's extension (systems/wear):
* @bevy bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>> */
export function WearExtension(_: WearExtensionProps): ReactNode {
throw new TypeError("WearExtension goes in an ExtendedMaterial: <ExtendedMaterial base={<StandardMaterial />} extension={<WearExtension amount={0.6} />} />");
}
// the old material's `wear` from WearExtension's fields (its colours camelCase there)
function wearOf(w: WearExtensionProps): MeshStandardMaterialProps["wear"] {
const { chip_color, grime_color, rust_color, ...rest } = w;
return { ...rest, ...(chip_color !== undefined ? { chipColor: chip_color } : {}), ...(grime_color !== undefined ? { grimeColor: grime_color } : {}), ...(rust_color !== undefined ? { rustColor: rust_color } : {}) };
}
/** raea's extension of StandardMaterial written in WESL (the engine's ShaderExt, docs/shaders.feature SH1): its
* `fn surface` runs before Bevy's lighting and its `fn lit` after it, on the base's inputs, so the surface stays lit
* and shadowed. raea/3d's <MeshStandardMaterial shader> is the same thing; the spec is SurfaceShaderSpec. It goes in an
* ExtendedMaterial's `extension`, alone.
* @bevy bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_shader::ShaderExt> */
export type ShaderExtensionProps = SurfaceShaderSpec;
export function ShaderExtension(_: ShaderExtensionProps): ReactNode {
throw new TypeError("ShaderExtension goes in an ExtendedMaterial: <ExtendedMaterial base={<StandardMaterial />} extension={<ShaderExtension wesl={src} />} />");
}
/** raea's extension of StandardMaterial that cel-shades it (the engine's ToonExt; three.js's MeshToonMaterial): the
* scene's lights in `steps` hard bands (2; `bands` for an explicit ramp, darkest first), the bottom one
* `shadow_color` (the base colour darker, nudged towards violet), with an optional rim, highlight and ink outline
* (true for their defaults). Its base gives base_color, base_color_texture, emissive, alpha_mode and material; a
* toon surface has no roughness or metal. It goes in an ExtendedMaterial's `extension`, alone. */
export interface ToonExtensionProps {
steps?: number;
bands?: ToonBand[];
shadow_color?: string;
rim?: boolean | ToonRim;
highlight?: boolean | ToonHighlight;
outline?: boolean | ToonOutline;
rim_intensity?: number;
highlight_intensity?: number;
outline_width?: number;
/** its fields' tracks, as a StandardMaterial's `animate` (its base animates base_color and emissive) */
animate?: ToonExtensionAnimate;
}
export interface ToonExtensionAnimate {
shadow_color?: TrackSpec<string>;
rim_intensity?: TrackSpec<number>;
highlight_intensity?: TrackSpec<number>;
outline_width?: TrackSpec<number>;
}
export function ToonExtension<A>(_: ToonExtensionProps & { animate?: Only<A, ToonExtensionAnimate> }): ReactNode {
throw new TypeError("ToonExtension goes in an ExtendedMaterial: <ExtendedMaterial base={<StandardMaterial />} extension={<ToonExtension steps={3} />} />");
}
// the base's fields a toon surface takes; the rest (roughness, metal, maps) it has no use for
const TOON_BASE = new Set(["base_color", "base_color_texture", "emissive", "alpha_mode", "material", "animate"]);
+24 -5
View File
@@ -9,20 +9,37 @@ import { LinearRgba, Srgba, type Affine2, type SampledImage, type TransformValue
import { Material, materialShader, type MaterialProps } from "./material";
/** a primitive's mesh attributes: its Mesh::ATTRIBUTE_COLOR, one linear colour per vertex (as mesh.insert_attribute) */
export interface MeshAttributes { vertex_colors?: (LinearRgba | [number, number, number, number])[] }
export interface MeshAttributes {
/** one linear colour a vertex, in the mesh's vertex order (ATTRIBUTE_COLOR) */
vertex_colors?: (LinearRgba | [number, number, number, number])[];
}
/** a 2D shape as Bevy's Ring: of it and `inner` (the same shape's fields), or its to_ring(`ring`, a thickness) */
export interface RingProps { ring?: number; inner?: Record<string, unknown> }
export interface RingProps {
/** a thickness: the shape made a ring that thick (to_ring) */
ring?: number;
/** the ring's inner shape, as the same shape's fields */
inner?: Record<string, unknown>;
}
type Vec2 = [number, number];
export interface CircleProps extends MeshAttributes, RingProps { radius?: number }
export interface RectangleProps extends MeshAttributes, RingProps { half_size?: Vec2 }
export interface RectangleProps extends MeshAttributes, RingProps {
/** half its width and height */
half_size?: Vec2;
}
export interface EllipseProps extends MeshAttributes, RingProps { half_size?: Vec2 }
export interface RegularPolygonProps extends MeshAttributes, RingProps { circumcircle?: { radius: number }; sides?: number }
/** an arc: its radius and half its angle in radians (Bevy's CircularSector::new(r, a) gives half_angle a) */
export interface ArcProps extends MeshAttributes, RingProps { arc?: { radius: number; half_angle: number } }
export interface ArcProps extends MeshAttributes, RingProps {
/** its radius and half its angle in radians */
arc?: { radius: number; half_angle: number };
}
export interface AnnulusProps extends MeshAttributes, RingProps { inner_circle?: { radius: number }; outer_circle?: { radius: number } }
export interface Capsule2dProps extends MeshAttributes, RingProps { radius?: number; half_length?: number }
export interface RhombusProps extends MeshAttributes, RingProps { half_diagonals?: Vec2 }
export interface VerticesProps extends MeshAttributes, RingProps { vertices?: Vec2[] }
export interface VerticesProps extends MeshAttributes, RingProps {
/** the outline's points, in order */
vertices?: Vec2[];
}
export interface ColorMaterialProps {
/** white by default; it tints the texture, and its alpha is the material's (Bevy's Srgba or LinearRgba, or a hex) */
color?: string | Srgba | LinearRgba;
@@ -61,7 +78,9 @@ const PRIMITIVES = new Map<unknown, string>([[Circle, "Circle"], [Rectangle, "Re
export const ColorMaterial = inMesh2d("ColorMaterial") as (p: ColorMaterialProps) => ReactNode;
export interface Mesh2dProps extends Omit<Place2dProps, "x" | "y" | "rotation" | "scale" | "z"> {
/** where it stands: translation, rotation (a quaternion) and scale */
transform?: TransformValue;
/** "Hidden" draws nothing; "Visible" and "Inherited" draw */
visibility?: "Inherited" | "Visible" | "Hidden";
/** one of bevy_math's 2D primitives (<Circle>, <Capsule2d>, ...) and a <ColorMaterial>, or your own <Material>
* (Bevy's Material2d, docs/control.feature FC2a) */
+4
View File
@@ -124,6 +124,7 @@ const MID = f(0.8), MID_INV = f(1.25), PI = f(Math.PI);
/** Bevy's Okhsla: Oklab's hue (degrees), a saturation relative to the sRGB gamut, and a lightness with a toe, each
* 0..1. @bevy bevy_color::Okhsla */
export class Okhsla {
/** Hue in degrees, saturation, lightness and alpha 0 to 1, in Okhsl. */
constructor(public hue: number, public saturation: number, public lightness: number, public alpha = 1) {}
/** From Oklab (bevy_color oklab_to_okhsl). */
static from_oklaba(lab: Oklaba): Okhsla {
@@ -168,12 +169,15 @@ export class Okhsla {
}
return new Oklaba(L, mul(C, a_), mul(C, b_), alpha);
}
/** The same colour as a LinearRgba. */
to_linear(): LinearRgba {
return this.to_oklaba().to_linear();
}
/** The same colour as an Srgba. */
to_srgba(): Srgba {
return this.to_oklaba().to_srgba();
}
/** The same colour with this alpha. */
with_alpha(alpha: number): Okhsla {
return new Okhsla(this.hue, this.saturation, this.lightness, alpha);
}
+15
View File
@@ -10,20 +10,35 @@ import type { ProceduralSurface } from "../overlays";
* faces up, `dirt` in joints, hollows, undersides and the floor line, `edges` worn lighter. The pattern overrides the
* base's colour and roughness; its lighting stays. It goes in an ExtendedMaterial's `extension`, alone. */
export interface ProceduralExtensionProps {
/** what it draws: noise, wood, marble, stone, brick, tiles, fabric, brushed or plaster */
pattern: ProceduralSurface["pattern"];
/** the pattern's two colours */
colors?: [string, string];
/** how many metres across its features are */
scale?: number;
/** the first colour's roughness, 0..1 */
rough_a?: number;
/** the second colour's roughness, 0..1 */
rough_b?: number;
/** how deep the pattern's relief looks (0 or more) */
bump?: number;
/** brick and tiles: a cell's [width, height] in metres */
tile?: [number, number];
/** brick and tiles: the joints' width in metres */
gap?: number;
/** the joints' colour */
gap_color?: string;
/** 0..1 dust on what faces up */
dust?: number;
/** 0..1 dirt in joints, hollows, undersides and along the floor line */
dirt?: number;
/** 0..1 wear on the edges, lighter */
edges?: number;
/** the dust's colour */
dust_color?: string;
/** the dirt's colour */
dirt_color?: string;
/** which randomness the pattern uses */
seed?: number;
}
+1
View File
@@ -30,6 +30,7 @@ export interface Text2dProps extends TextStyleProps, TextRunProps {
bounds?: [number | null, number | null];
/** Text2dShadow (true for its default); inside a Canvas3D */
shadow?: Text2dShadow | true;
/** the text, and TextSpan runs */
children?: ReactNode;
}
+6 -1
View File
@@ -20,9 +20,14 @@ export interface UiDebugOptions {
const Global = createContext<UiDebugOptions | null>(null);
export interface GlobalUiDebugOptionsProps extends UiDebugOptions {
/** the UI the overlay draws over */
children?: ReactNode;
}
/** bevy_ui's GlobalUiDebugOptions: the debug overlay for every node inside that has no UiDebugOptions of its own
* (a node's `ui_debug`). @bevy bevy_ui_render::GlobalUiDebugOptions */
export function GlobalUiDebugOptions({ children, ...options }: UiDebugOptions & { children?: ReactNode }) {
export function GlobalUiDebugOptions({ children, ...options }: GlobalUiDebugOptionsProps) {
return <Global.Provider value={options}>{children}</Global.Provider>;
}
+1
View File
@@ -50,6 +50,7 @@ export interface EditableTextProps extends NodeProps, TextStyleProps {
auto_focus?: boolean;
/** TextLayout's justify and linebreak */
justify?: TextProps["justify"];
/** where lines break: WordBoundary, AnyCharacter, WordOrCharacter or NoWrap */
linebreak?: TextProps["linebreak"];
}
+2
View File
@@ -52,7 +52,9 @@ export const FontCx = {
* @bevy bevy_text::FontAtlas */
export interface FontAtlas {
texture: string;
/** the texture's width in px */
width: number;
/** the texture's height in px */
height: number;
}
+18 -2
View File
@@ -29,7 +29,16 @@ export type SliceScaleMode = "Stretch" | { Tile: { stretch_value: number } };
/** bevy_sprite's TextureSlicer: the slices' insets in the picture's px, how the sides and centre scale (Stretch by
* default), and the corners' most scale (1 by default) */
export interface TextureSlicer { border: { left: number; right: number; top: number; bottom: number }; center_scale_mode?: SliceScaleMode; sides_scale_mode?: SliceScaleMode; max_corner_scale?: number }
export interface TextureSlicer {
/** the slices' insets, in the picture's px */
border: { left: number; right: number; top: number; bottom: number };
/** how the centre scales (Stretch) */
center_scale_mode?: SliceScaleMode;
/** how the sides scale (Stretch) */
sides_scale_mode?: SliceScaleMode;
/** how much the corners may scale at most (1) */
max_corner_scale?: number;
}
/** bevy_image's TextureAtlasLayout: a sheet's size and its cells' rects in px. @bevy bevy_image::TextureAtlasLayout */
export interface TextureAtlasLayout { size: [number, number]; textures: { x: number; y: number; w: number; h: number }[] }
@@ -108,9 +117,16 @@ function AtlasNode({ image, color, flip_x, flip_y, children, fixed, texture_atla
const Sampler = createContext<"Linear" | "Nearest">("Linear");
const RENDERING = { Linear: undefined, Nearest: "pixelated" } as const;
export interface ImagePluginProps {
/** "Linear" (the default) or "Nearest" (pixel art) */
default_sampler?: "Linear" | "Nearest";
/** the UI and sprites whose pictures it samples */
children?: ReactNode;
}
/** bevy_image's ImagePlugin: its default_sampler for every picture drawn inside it (Linear by default;
* ImagePlugin::default_nearest() is default_sampler="Nearest", for pixel art). @bevy bevy_image::ImagePlugin */
export function ImagePlugin({ default_sampler, children }: { default_sampler?: "Linear" | "Nearest"; children?: ReactNode }) {
export function ImagePlugin({ default_sampler, children }: ImagePluginProps) {
if (default_sampler !== undefined && !(default_sampler in RENDERING)) throw new TypeError(`ImagePlugin: default_sampler is Linear or Nearest, got ${JSON.stringify(default_sampler)}`);
return <Sampler.Provider value={default_sampler ?? "Linear"}>{children}</Sampler.Provider>;
}
+1
View File
@@ -20,6 +20,7 @@ export interface MaterialNodeProps extends NodeProps {
textures?: Record<string, string>;
/** shader defs, as a Material's */
defs?: Record<string, boolean | number>;
/** the nodes inside it */
children?: ReactNode;
}
+59
View File
@@ -0,0 +1,59 @@
// What the UI's roots are drawn through: bevy_ui's UiScale, the UI camera's Viewport and UiTargetCamera.
import type { ReactNode } from "react";
import { UiScaleCx } from "./ui";
export interface UiScaleProps {
/** how many times as big the UI is drawn (UiScale) */
value: number;
/** the UI it scales */
children?: ReactNode;
}
/** bevy_ui's UiScale: every UI length inside times `value` (2 draws a 16 px node 32 px), as CSS's zoom: laid out
* and its text shaped at that size, in physical px, as Bevy lays out (a 3 px padding at 1.25 is 4 px, not 3 drawn 1.25
* times as big). Text2d and the 2D and 3D parts aren't UI, so they stay as they are.
* @bevy bevy_ui::UiScale */
export function UiScale({ value, children }: UiScaleProps) {
if (!(Number.isFinite(value) && value > 0)) throw new RangeError(`UiScale: value is above 0, got ${value}`);
return (
<div style={{ position: "absolute", left: 0, top: 0, width: "100%", height: "100%", zoom: value }}>
<UiScaleCx.Provider value={value}>{children}</UiScaleCx.Provider>
</div>
);
}
export interface ViewportProps {
/** the region's top-left corner, px from the window's */
physical_position: [number, number];
/** the region's width and height, px */
physical_size: [number, number];
/** the cameras and UI drawn into the region */
children?: ReactNode;
}
/** The UI camera's viewport (bevy_camera's Viewport on the Camera2d the UI draws through): its roots lay out in this
* region of the window, `physical_position` from its top left and `physical_size` big (px, at a scale factor of 1),
* and are clipped to it. @bevy bevy_camera::Viewport */
export function Viewport({ physical_position, physical_size, children }: ViewportProps) {
const ok = (v: unknown, min: number) => Array.isArray(v) && v.length === 2 && v.every((n) => Number.isInteger(n) && n >= min);
if (!ok(physical_position, 0) || !ok(physical_size, 1)) throw new RangeError(`Viewport: physical_position is [x, y] >= 0 and physical_size [w, h] >= 1 in whole px, got ${JSON.stringify({ physical_position, physical_size })}`);
const [[left, top], [width, height]] = [physical_position, physical_size];
return <div style={{ position: "absolute", left, top, width, height, overflow: "hidden" }}>{children}</div>;
}
export interface UiTargetCameraProps {
/** the camera, by its order, these roots draw with (0) */
order?: number;
/** the UI roots that camera draws */
children?: ReactNode;
}
/** The roots inside drawn by their own Camera2d (bevy_ui's UiTargetCamera): a layer over the whole window, stacked by
* the camera's `order` as Bevy draws its cameras, lowest first. Cameras on one window share its main texture, which
* only the first of them clears (bevy_render's ViewTarget, its first call), so the window's clear is the layered
* <Canvas3D clearColor>'s and a later camera's own clear colour shows nowhere. Roots outside any are the default
* camera's (the highest order). @bevy bevy_ui::UiTargetCamera */
export function UiTargetCamera({ order = 0, children }: UiTargetCameraProps) {
if (!Number.isInteger(order)) throw new RangeError(`UiTargetCamera: order is a whole number, got ${order}`);
return <div style={{ position: "absolute", left: 0, top: 0, width: "100%", height: "100%", zIndex: order, isolation: "isolate" }}>{children}</div>;
}
+6 -1
View File
@@ -5,7 +5,12 @@ import { checkVal, type Overflow, type UiRect, type Val } from "./ui-val";
/** bevy_ui's IgnoreScroll: the axes on which a node keeps its place while its parent scrolls (BVec2).
* @bevy bevy_ui::IgnoreScroll */
export interface IgnoreScroll { x: boolean; y: boolean }
export interface IgnoreScroll {
/** it keeps its place while the parent scrolls across */
x: boolean;
/** it keeps its place while the parent scrolls down */
y: boolean;
}
export interface ScrollProps { overflow?: Overflow; padding?: UiRect; scrollbar_width?: number; scroll_position?: [number, number]; ignore_scroll?: IgnoreScroll }
+8 -1
View File
@@ -15,10 +15,17 @@ export function targetImage(name: string, width: number, height: number): string
return `raea-screen:${name}@${width}x${height}`;
}
export interface UiTextureProps {
/** the image's name, as a material or ImageNode uses it */
target: string;
/** the UI roots drawn into it */
children?: ReactNode;
}
/** The UI roots inside drawn into `target` instead of the window (a Camera2d with RenderTarget::Image, the roots'
* UiTargetCamera): laid out in a box the image's size, see-through where they draw nothing, and nowhere in the frame
* itself. A root's 100% is the image's size. @bevy bevy_camera::RenderTarget::Image */
export function UiTexture({ target, children }: { target: string; children?: ReactNode }) {
export function UiTexture({ target, children }: UiTextureProps) {
const m = /^raea-screen:([A-Za-z0-9_-]+)@(\d+)x(\d+)$/.exec(target);
if (!m) throw new TypeError(`UiTexture: target is a targetImage(name, width, height), got ${JSON.stringify(target)}`);
return screenContent(m[1], { resolution: [Number(m[2]), Number(m[3])], crt: false, background: "transparent", children });
+8 -1
View File
@@ -93,9 +93,16 @@ export function shadowCss(who: string, b: BoxShadow): string {
/** the BoxShadowSamples around a node: 4, bevy_ui_render's default, outside one */
export const ShadowSamplesCx = createContext(4);
export interface BoxShadowSamplesProps {
/** steps each shadow's blur is summed in (4) */
samples: number;
/** the UI it applies to */
children?: ReactNode;
}
/** bevy_ui_render's BoxShadowSamples: the steps each shadow's blur is summed in down its height (4 by default). Bevy sets
* it on a UI camera; here it wraps the UI that camera draws. @bevy bevy_ui_render::BoxShadowSamples */
export function BoxShadowSamples({ samples, children }: { samples: number; children?: ReactNode }) {
export function BoxShadowSamples({ samples, children }: BoxShadowSamplesProps) {
if (!(Number.isInteger(samples) && samples >= 0)) throw new RangeError(`BoxShadowSamples: samples is a whole number, 0 or more, got ${samples}`);
return createElement(ShadowSamplesCx.Provider, { value: samples }, children);
}
+14 -36
View File
@@ -232,9 +232,14 @@ export function Node({ children, fixed, ...p }: NodeProps) {
return boxOf(n.css, n.back, children, fixed ? "fixed" : ui === null, undefined, { ...n.attrs, ...handlersOf("Node", p) });
}
export interface GhostNodeProps {
/** what's laid out as the parent's children */
children?: ReactNode;
}
/** bevy_ui's GhostNode: no box of its own, its children laid out as its parent's (CSS display: contents), each one a
* root when it is at the top. @bevy bevy_ui::experimental::GhostNode */
export function GhostNode({ children }: { children?: ReactNode }) {
export function GhostNode({ children }: GhostNodeProps) {
return useContext(InUi) === null ? <>{children}</> : <div style={{ display: "contents" }}>{children}</div>;
}
@@ -282,9 +287,11 @@ function variationsCss(who: string, v: Record<string, number> | undefined): stri
export interface TextRunProps {
/** Underline and Strikethrough: a line under or through the run, as thick as the font says */
underline?: boolean;
/** a line through the run */
strikethrough?: boolean;
/** UnderlineColor and StrikethroughColor: the lines' colours (the text's colour by default) */
underline_color?: Color;
/** the strikethrough's colour (the text's by default) */
strikethrough_color?: Color;
/** TextBackgroundColor: a box behind the run, line by line */
text_background_color?: Color;
@@ -411,8 +418,13 @@ export function Text({ children, font, font_size, weight, style, font_width, col
return boxOf({ ...css, ...BREAK[linebreak ?? "WordBoundary"] }, n.back, own, ui === null, <style>{t.face}</style>, { ...n.attrs, "data-raea-bevy-text": "" });
}
export interface TextSpanProps extends TextStyleProps, TextRunProps {
/** the run's text */
children?: ReactNode;
}
/** A run of a <Text> in a style of its own (Bevy's defaults, not its Text's, where left out). @bevy bevy_text::text::TextSpan */
export function TextSpan({ children, underline, strikethrough, underline_color, strikethrough_color, text_background_color, ...p }: TextStyleProps & TextRunProps & { children?: ReactNode }) {
export function TextSpan({ children, underline, strikethrough, underline_color, strikethrough_color, text_background_color, ...p }: TextSpanProps) {
const back = useContext(InUi)?.back;
// bevy_text leaves out a span whose size is 0 or less (TextPipeline: "Nothing will be displayed"), its Text's other
// runs laid out without it
@@ -454,37 +466,3 @@ export function Text2d({ transform, justify, anchor = [0, 0], children, bounds,
</div>
);
}
/** bevy_ui's UiScale: every UI length inside times `value` (2 draws a 16 px node 32 px), as CSS's zoom: laid out
* and its text shaped at that size, in physical px, as Bevy lays out (a 3 px padding at 1.25 is 4 px, not 3 drawn 1.25
* times as big). Text2d and the 2D and 3D parts aren't UI, so they stay as they are.
* @bevy bevy_ui::UiScale */
export function UiScale({ value, children }: { value: number; children?: ReactNode }) {
if (!(Number.isFinite(value) && value > 0)) throw new RangeError(`UiScale: value is above 0, got ${value}`);
return (
<div style={{ position: "absolute", left: 0, top: 0, width: "100%", height: "100%", zoom: value }}>
<UiScaleCx.Provider value={value}>{children}</UiScaleCx.Provider>
</div>
);
}
/** The UI camera's viewport (bevy_camera's Viewport on the Camera2d the UI draws through): its roots lay out in this
* region of the window, `physical_position` from its top left and `physical_size` big (px, at a scale factor of 1),
* and are clipped to it. @bevy bevy_camera::Viewport */
export function Viewport({ physical_position, physical_size, children }: { physical_position: [number, number]; physical_size: [number, number]; children?: ReactNode }) {
const ok = (v: unknown, min: number) => Array.isArray(v) && v.length === 2 && v.every((n) => Number.isInteger(n) && n >= min);
if (!ok(physical_position, 0) || !ok(physical_size, 1)) throw new RangeError(`Viewport: physical_position is [x, y] >= 0 and physical_size [w, h] >= 1 in whole px, got ${JSON.stringify({ physical_position, physical_size })}`);
const [[left, top], [width, height]] = [physical_position, physical_size];
return <div style={{ position: "absolute", left, top, width, height, overflow: "hidden" }}>{children}</div>;
}
/** The roots inside drawn by their own Camera2d (bevy_ui's UiTargetCamera): a layer over the whole window, stacked by
* the camera's `order` as Bevy draws its cameras, lowest first. Cameras on one window share its main texture, which
* only the first of them clears (bevy_render's ViewTarget, its first call), so the window's clear is the layered
* <Canvas3D clearColor>'s and a later camera's own clear colour shows nowhere. Roots outside any are the default
* camera's (the highest order). @bevy bevy_ui::UiTargetCamera */
export function UiTargetCamera({ order = 0, children }: { order?: number; children?: ReactNode }) {
if (!Number.isInteger(order)) throw new RangeError(`UiTargetCamera: order is a whole number, got ${order}`);
return <div style={{ position: "absolute", left: 0, top: 0, width: "100%", height: "100%", zIndex: order, isolation: "isolate" }}>{children}</div>;
}
Loaded 100 of 123 files, more files were not shown because too many files have changed in this diff. Show more