Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
H12: done. docs/blitz-bevy.feature H12 @done with its status (ts-native P27c points at it); the appscreen bench (sdk/raea/bench/bevy/appscreen: a button clicked through the 3D, its own timer on the frame's clock; check.sh 9 PASS) and its bench/render-play row (1.000000 at frames 6, 12, 18 and 27; the bench 14 of 14); the apps guide, <Screen app>'s doc and the manual's reference; skills pin: raea-skills #89 (80067cc), motion/apps.md the same guide
shinyobjectz3ad88f635a5f
diff --git a/bench/render-play/appscreen.json b/bench/render-play/appscreen.jsonnew file mode 100644index 00000000..2f17747f--- /dev/null+++ b/bench/render-play/appscreen.json@@ -0,0 +1,7 @@+{+ "0": ["Pointer:480:60"],+ "6": ["Pointer:480:260"],+ "10": ["Pointer:480:260:down"],+ "12": ["Pointer:480:260"],+ "21": ["Pointer:480:60"]+}diff --git a/bench/render-play/rows.tsv b/bench/render-play/rows.tsvindex 0fca3eb0..9abdf51a 100644--- a/bench/render-play/rows.tsv+++ b/bench/render-play/rows.tsv@@ -8,7 +8,8 @@# React on the page with 3D in the world, picking and input replay are all here: the games (pong and platformer on# the page, arena3d's 3D drawn live), bevy-ts' live cases (keys, the pointer, a gamepad, the window and the World's# components through useQuery), the bridge's Engine reads (engine3d: a cube the World moves, React's marker reading it)-# and pick3d (on* on 3D parts: hover, press, leave); an <R3F>'s own pointer events and <OrbitControls> (r3f live/pointer)+# and pick3d (on* on 3D parts: hover, press, leave); an <R3F>'s own pointer events and <OrbitControls> (r3f live/pointer);+# an app screen's button clicked through the 3D, its own timer on the frame's clock (appscreen: blitz-bevy H12)sdk/react/bench/games/pong/edit.tsx keys:ArrowUp,ArrowDown,,ArrowUp 0.25 0.75 1.25 1.75sdk/react/bench/games/platformer/edit.tsx keys:ArrowRight,ArrowRight+ArrowUp,ArrowRight, 0.25 0.75 1.25 1.75sdk/react/bench/games/arena3d/edit.tsx keys:ArrowRight,ArrowUp,ArrowLeft+ArrowUp,ArrowDown, 0.25 0.75 1.25 1.75@@ -22,3 +23,4 @@ sdk/raea/bench/bevy-ts/cases/text3d-readback.tsx script:sdk/raea/bench/bevy-ts/cbench/bridge/engine3d.tsx - 0.3 0.9 1.25sdk/raea/bench/bevy/pick3d/edit.tsx script:bench/render-play/pick3d.json 0.1 0.2 0.3 0.4 0.6 0.9sdk/r3f/test/live/pointer.tsx script:sdk/r3f/test/live/pointer.json 0.2 0.4 0.6 0.9+sdk/raea/bench/bevy/appscreen/edit.tsx script:bench/render-play/appscreen.json 0.2 0.4 0.6 0.9diff --git a/docs/manual/reference/sdk/3d.md b/docs/manual/reference/sdk/3d.mdindex 1124751f..df195378 100644--- a/docs/manual/reference/sdk/3d.md+++ b/docs/manual/reference/sdk/3d.md@@ -2281,7 +2281,7 @@ The props of [`Screen`](#screen), tabled there.| `background` | `string` | behind the picture ("#000000"). A see-through one ("#ffffff00", "transparent", rgba(..., 0.5)) makes the screen see-through where its page paints nothing, so what's behind it in the scene shows (a flat screen: a layer of a page pulled apart in 3D); an opaque one keeps the screen opaque, which writes depth for DepthOfField || `brightness` | `number` | a flat screen's (`crt={false}`) light: 1, the default, draws its page at the page's own colours, unlit (scene lights don't touch it); above 1 it glows, and blooms under a <Bloom>. A tone curve on the camera bends it like the rest of the frame: give the scene <ToneMapping mode="none" /> to keep the page's colours exact. A CRT's is `crt.brightness` || `src` | `string` | a video to show instead of children: staticFile("clip.mp4"), filling the picture |-| `app` | `string` | an app to show instead of children: a module's path from the composition's folder ("chat.tsx"), its default export a React component given {width, height}. It runs on real react-dom in a document of its own, so npm's React libraries work on it (assistant-ui, Radix; installed with `raea add`). In play the pointer reaches it through the 3D, where it lands on the picture, and a press on it gives it the keys (the game doesn't get them) until a press elsewhere or Escape; in a render it runs on the frame's clock, so the render repeats |+| `app` | `string` | an app to show instead of children: a module's path from the composition's folder ("chat.tsx"), its default export a React component given {width, height}. It runs on react-dom (@raea/ui's) in a Blitz document of its own, so npm's React libraries work on it (assistant-ui, Radix; installed with `raea add`). In play the pointer reaches it through the 3D, where it lands on the picture, and a press on it gives it the keys (the game doesn't get them) until a press elsewhere or Escape; in a render it runs on the frame's clock, so the render repeats || `children` | `ReactNode` | the nested composition or game |### `Section`diff --git a/sdk/guides/craft/motion/apps.md b/sdk/guides/craft/motion/apps.mdindex ed3ee1ae..356195e7 100644--- a/sdk/guides/craft/motion/apps.md+++ b/sdk/guides/craft/motion/apps.md@@ -10,25 +10,28 @@ the native one (Rune) chosen by `export const app = { target }`, is `raea app ru- Packages: `raea add @assistant-ui/react` writes `package.json` and `raea.lock` and lays out `node_modules`. raea's own packagemanager does it; no Node, npm or bun is needed, and install scripts never run.- A React library that needs a real DOM (assistant-ui, Radix, shadcn) runs as an app: a module whose default export is- a component taking `{ width, height }`, running on real react-dom in a document of its own. Place it:+ a component taking `{ width, height }`, running on react-dom in a document of its own (@raea/ui's, on a Blitz page:+ what raea feed runs on), with the CSS its modules import and Tailwind's for its folder. Place it:- on a screen in 3D: `<Screen name="chat" app="chat.tsx" resolution={[480, 640]} crt={false} />` (beside the 3D, oras a Model's `screens` entry). The path is relative to the composition's folder;- as an app panel or tool: `export const surface = "dom"` in the panel's file.- Input in live play: the pointer reaches an app screen through the 3D (where it lands on the picture). Pressing on thescreen gives it the keys, and the game gets none until a press elsewhere or Escape.-- Renders: an app runs on the frame clock (timers, `Date`, `performance.now`, `requestAnimationFrame` follow the frame),- so a render repeats frame for frame.-- Exported games: `export-game` bundles each app with its packages. The player must be built with them:- `cargo build --profile game -p raea-app-game --bin raea-game --features player,surfaces` (+6.7 MB); export refuses- an app screen with a player built without.+- Renders: an app screen is stepped once a frame on the frame clock (its timers and `performance.now` follow the frame),+ so a render repeats frame for frame. A render of a play's input log (`render --input`) gives it what reached it in+ the play, so the render draws what was played.+- Exported games: `export-game` bundles each app with its packages (`chat.tsx.surface.js` and `.surface.css`), and the+ player draws it on its own Blitz page.Not yet:- An app as a flat 2D layer of a composition. It can be a 3D `<Screen>` or an app panel only; for a flat look, put a`crt={false}` screen square to the camera.- A composition itself importing a DOM library. Only an app (above) can; the composition's own React is raea's literuntime.-- Input to an app in a render: `render --input` replays the page's input, but an app screen gets none. Script what it- should show inside the app, on its own timers.+- `Date` in an app screen: it reads the wall clock, so a render shows another time than its play. Use timers or+ `performance.now`.+- A drag that leaves an app screen: it ends at the edge (a browser's goes on). A double click on one.+- The page host's desktop calls in an app screen (the clipboard, links, notifications).- Anything in front of a screen blocking its clicks: the ray hits the nearest screen, through other objects. It alsoassumes the 3D fills the stage.- Network calls in an app during a render: nothing records and replays them, so a render that calls a model doesn'tdiff --git a/sdk/raea/bench/bevy/appscreen/check.sh b/sdk/raea/bench/bevy/appscreen/check.shnew file mode 100644index 00000000..c08601fb--- /dev/null+++ b/sdk/raea/bench/bevy/appscreen/check.sh@@ -0,0 +1,39 @@+#!/bin/bash+# The appscreen fixture's measurements (docs/blitz-bevy.feature H12: <Screen app>, a module on its own Blitz document):+# edit.tsx played live offscreen with bench/render-play/appscreen.json's pointer (over the button from frame 6, pressed+# at 10 and let go at 12, off the screen from 21), and the play's input log rendered. On the render's frames:+# drawn the app is on the screen (its dark ground, the button blue) and neither run says it isn't drawn+# hover the button rings yellow while the pointer is over it (frame 9), and not once it's gone (frame 27)+# click the button is blue while pressed (frame 11) and green from the release on (frames 13 and 27)+# clock the bar its timer grows is there at frame 27 and not at frame 0+# bash sdk/raea/bench/bevy/appscreen/check.sh [RAEA_BIN] exits 1 on any failure+here=$(cd "$(dirname "$0")" && pwd)+root=$(cd "$here/../../../../.." && pwd)+bin=${1:-${RAEA_BIN:-$root/target/release/raea}}+out=$(mktemp -d "${TMPDIR:-/tmp}/raea-appscreen-check-XXXXXX")+trap 'rm -rf "$out"' EXIT+export RAEA_SIGN=0 RAEA_MARK=0 RAEA_AUDIO_MUTE=1+(cd "$here" && "$bin" play edit.tsx --offscreen --size 960x540 --seconds 1 --input-script "$root/bench/render-play/appscreen.json" --input-log "$out/input.json") > "$out/play.log" 2>&1 || { echo "appscreen: the play failed"; cat "$out/play.log"; exit 1; }+"$bin" render "$here/edit.tsx" --input "$out/input.json" -o "$out/" > "$out/render.log" 2>&1 || { echo "appscreen: the render failed"; cat "$out/render.log"; exit 1; }+status=0+pass() { echo "appscreen: PASS $1"; }+fail() { echo "appscreen: FAIL $1"; status=1; }+# a pixel of frame F at X,Y as "R G B"+px() { ffmpeg -v error -i "$out/frame-$(printf %05d "$1").png" -vf "crop=1:1:$2:$3" -f rawvideo -pix_fmt rgb24 - | od -An -tu1 | tr -s ' ' | sed 's/^ //'; }+body() { px "$1" 420 290; } # the button's face, below its label+ring() { px "$1" 390 290; } # its border's left edge+bar() { px "$1" 341 379; } # the bar's first 40 px+green() { read -r r g b <<< "$1"; [ "$g" -gt 140 ] && [ "$g" -gt "$b" ] && [ "$g" -gt "$r" ]; }+blue() { read -r r g b <<< "$1"; [ "$b" -gt 200 ] && [ "$b" -gt "$g" ]; }+yellow() { read -r r g b <<< "$1"; [ "$r" -gt 200 ] && [ "$g" -gt 150 ] && [ "$b" -lt 120 ]; }+pink() { read -r r g b <<< "$1"; [ "$r" -gt 200 ] && [ "$g" -lt 140 ]; }+if grep -q "isn't drawn yet\|didn't open" "$out/play.log" "$out/render.log"; then fail "drawn (a run says: $(grep -h -m1 "isn't drawn yet\|didn't open" "$out/play.log" "$out/render.log"))"; else pass "neither run says the app screen isn't drawn"; fi+blue "$(body 3)" && pass "the button is on the screen, blue (frame 3: $(body 3))" || fail "the button isn't on the screen (frame 3: $(body 3))"+yellow "$(ring 9)" && pass "the button rings with the pointer over it (frame 9: $(ring 9))" || fail "no ring with the pointer over the button (frame 9: $(ring 9))"+blue "$(body 11)" && pass "pressed, not yet let go, it's still blue (frame 11: $(body 11))" || fail "the button changed before its release (frame 11: $(body 11))"+green "$(body 13)" && pass "the click reached it: green from the release (frame 13: $(body 13))" || fail "the click didn't reach the button (frame 13: $(body 13))"+green "$(body 27)" && pass "it stays clicked (frame 27: $(body 27))" || fail "the click didn't hold (frame 27: $(body 27))"+yellow "$(ring 27)" && fail "the ring stayed after the pointer left (frame 27: $(ring 27))" || pass "the ring went with the pointer (frame 27: $(ring 27))"+! pink "$(bar 0)" && pink "$(bar 27)" && pass "its timer's bar grew on the frame's clock (frame 0: $(bar 0), frame 27: $(bar 27))" || fail "the timer's bar (frame 0: $(bar 0), frame 27: $(bar 27))"+grep -q '"apps"' "$out/input.json" && pass "the play's log keeps what reached the app screen" || fail "the play's log has no apps entries"+exit $statusdiff --git a/sdk/raea/bench/bevy/appscreen/edit.tsx b/sdk/raea/bench/bevy/appscreen/edit.tsxnew file mode 100644index 00000000..99990522--- /dev/null+++ b/sdk/raea/bench/bevy/appscreen/edit.tsx@@ -0,0 +1,21 @@+// <Screen app> (docs/blitz-bevy.feature H12): an app screen, kit.tsx's component on @raea/ui's react-dom in a Blitz+// document of its own, on a flat screen in 3D (320 x 200, 2 units wide, filling x 295-665 and y 154-386 of the frame).+// Its button counts presses (blue "Press", then green "Pressed 1") and rings yellow while the pointer is over it; a pink+// bar along its foot grows on the app's own timer, so the app runs on the frame's clock. check.sh plays it with+// bench/render-play/appscreen.json's pointer and checks the render of the play's log; bench/render-play's row holds+// render = play.+import { AbsoluteFill, Composition, registerRoot } from "raea";+import { Screen, ToneMapping } from "raea/3d";+import { Camera3d } from "raea/camera";+import { Transform } from "raea/transform";++function Scene() {+ return (+ <AbsoluteFill style={{ background: "#000" }}>+ <Camera3d transform={Transform.fromXyz(0, 0, 4).lookingAt([0, 0, 0])} projection={{ Perspective: { fov: (40 * Math.PI) / 180 } }} />+ <ToneMapping mode="none" />+ <Screen name="kit" crt={false} resolution={[320, 200]} size={[2]} app="kit.tsx" background="#ffffff" />+ </AbsoluteFill>+ );+}+registerRoot(() => <Composition id="appscreen" component={Scene} width={960} height={540} fps={30} durationInFrames={30} />);diff --git a/sdk/raea/bench/bevy/appscreen/kit.tsx b/sdk/raea/bench/bevy/appscreen/kit.tsxnew file mode 100644index 00000000..81c7dc67--- /dev/null+++ b/sdk/raea/bench/bevy/appscreen/kit.tsx@@ -0,0 +1,26 @@+// The app on the appscreen bench's screen (edit.tsx): a button that counts presses and rings while the pointer is over+// it, and a bar its own timer grows 8 px every 100 ms.+import { useEffect, useState } from "react";++export default function Kit({ width, height }: { width: number; height: number }) {+ const [n, setN] = useState(0);+ const [hot, setHot] = useState(false);+ const [tick, setTick] = useState(0);+ useEffect(() => {+ const t = setInterval(() => setTick((v) => v + 1), 100);+ return () => clearInterval(t);+ }, []);+ return (+ <div style={{ position: "fixed", left: 0, top: 0, width, height, background: "#10151f", fontFamily: "Inter, sans-serif" }}>+ <button+ onClick={() => setN((v) => v + 1)}+ onPointerEnter={() => setHot(true)}+ onPointerLeave={() => setHot(false)}+ style={{ position: "absolute", left: 80, top: 50, width: 160, height: 80, boxSizing: "border-box", borderRadius: 12, border: `6px solid ${hot ? "#ffd23f" : "#10151f"}`, background: n > 0 ? "#22b573" : "#3a6cff", color: "#ffffff", fontSize: 24 }}+ >+ {n > 0 ? `Pressed ${n}` : "Press"}+ </button>+ <div style={{ position: "absolute", left: 0, bottom: 0, height: 12, width: Math.min(width, tick * 8), background: "#ff5d8f" }} />+ </div>+ );+}diff --git a/sdk/render/src/screen.tsx b/sdk/render/src/screen.tsxindex e93cb5bc..76fedc10a 100644--- a/sdk/render/src/screen.tsx+++ b/sdk/render/src/screen.tsx@@ -70,10 +70,10 @@ export interface ScreenSource {/** a video to show instead of children: staticFile("clip.mp4"), filling the picture */src?: string;/** an app to show instead of children: a module's path from the composition's folder ("chat.tsx"), its default- * export a React component given {width, height}. It runs on real react-dom in a document of its own, so npm's React- * libraries work on it (assistant-ui, Radix; installed with `raea add`). In play the pointer reaches it through- * the 3D, where it lands on the picture, and a press on it gives it the keys (the game doesn't get them) until a- * press elsewhere or Escape; in a render it runs on the frame's clock, so the render repeats */+ * export a React component given {width, height}. It runs on react-dom (@raea/ui's) in a Blitz document of its+ * own, so npm's React libraries work on it (assistant-ui, Radix; installed with `raea add`). In play the pointer+ * reaches it through the 3D, where it lands on the picture, and a press on it gives it the keys (the game doesn't+ * get them) until a press elsewhere or Escape; in a render it runs on the frame's clock, so the render repeats */app?: string;/** the nested composition or game */children?: ReactNode;diff --git a/skills b/skillsindex d6ba1129..80067cc2 160000--- a/skills+++ b/skills@@ -1 +1 @@-Subproject commit d6ba1129ef26f5a4936c65614d53ff0fcd087425+Subproject commit 80067cc20a625174e00b653efc1707c59dad5c7d