Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

FC0a: ui/widgets/tab_navigation ports at 0.9980: four TabGroups of four buttons, none focused. 91 of 95 ported examples pass

shinyobjectz9f1152a6f99b
diff --git a/bench/bevy-parity/examples.list b/bench/bevy-parity/examples.list
index 2f3ae724..6b2af971 100644
--- a/bench/bevy-parity/examples.list
+++ b/bench/bevy-parity/examples.list
@@ -94,3 +94,4 @@ ui/ui_drag_and_drop
ui/navigation/directional_navigation
ui/navigation/directional_navigation_overrides
ui/widgets/headless_tabs
+ui/widgets/tab_navigation
diff --git a/bench/bevy-parity/runs.tsv b/bench/bevy-parity/runs.tsv
index 01ea814b..a780a87f 100644
--- a/bench/bevy-parity/runs.tsv
+++ b/bench/bevy-parity/runs.tsv
@@ -93,3 +93,4 @@ ui/ui_drag_and_drop - 10
ui/navigation/directional_navigation - 10
ui/navigation/directional_navigation_overrides - 10
ui/widgets/headless_tabs - 10
+ui/widgets/tab_navigation - 10
diff --git a/docs/bevy-parity.md b/docs/bevy-parity.md
index 90eadc65..466dffb0 100644
--- a/docs/bevy-parity.md
+++ b/docs/bevy-parity.md
@@ -4,7 +4,7 @@ Bevy v0.20.0's examples against their raea TSX ports (docs/control.feature FC0a)
don't edit. An example passes when every probed frame passes pixels (SSIM 0.98 and no 32 px tile off by more than 24 of 255) and cost (batch keys and
frame time at most 1.25x the example's). Wall time is one machine's, measured in the same run.
-Examples: **438**, ported **94**, passing **90**, excluded **16** (docs/bevy-parity/excluded.tsv), left **332**.
+Examples: **438**, ported **95**, passing **91**, excluded **16** (docs/bevy-parity/excluded.tsv), left **331**.
raea's frame ms is its update's plus the time React takes to step a frame for its 3D (step), which the example
doesn't pay.
@@ -150,6 +150,7 @@ doesn't pay.
| ui/navigation/directional_navigation | 10 | 0.998057 | 8 | 0 / 0 | 471 / 493 | 5 / 7 | 1 / 1 | 37.601 / 1.225 = 1.225 + 0 | yes | |
| ui/navigation/directional_navigation_overrides | 10 | 0.996122 | 11 | 0 / 0 | 564 / 493 | 5 / 7 | 1 / 1 | 38.217 / 1.757 = 1.757 + 0 | yes | |
| ui/widgets/headless_tabs | 10 | 0.992999 | 11 | 0 / 0 | 478 / 493 | 5 / 7 | 1 / 1 | 44.815 / 1.798 = 1.798 + 0 | yes | |
+| ui/widgets/tab_navigation | 10 | 0.998035 | 4 | 0 / 0 | 500 / 493 | 5 / 7 | 1 / 1 | 36.809 / 1.624 = 1.624 + 0 | yes | |
## Excluded
diff --git a/sdk/raea/bench/bevy-parity/ui/widgets/tab_navigation.tsx b/sdk/raea/bench/bevy-parity/ui/widgets/tab_navigation.tsx
new file mode 100644
index 00000000..ec617074
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/ui/widgets/tab_navigation.tsx
@@ -0,0 +1,35 @@
+// Bevy v0.20.0 examples/ui/widgets/tab_navigation.rs in raea's TSX (docs/control.feature FC0a): a full-window column,
+// centred both ways with 6 px rows, of four labelled TabGroups ("TabGroup 0", "TabGroup 2", "TabGroup 1", "Modal
+// TabGroup", in Bevy's default font), each a row (6 px gaps, 10 px below) of four 200 x 65 buttons with 5 px black
+// borders on srgb(0.15, 0.15, 0.15), each "TabIndex i" in 20 px srgb(0.9, 0.9, 0.9) by its group's order (0 0 0 0,
+// 3 2 1 0, 0 1 2 3, 0 3 1 2). Nothing has focus, so no button has focus_system's white outline; hover, presses and Tab
+// change them only under input. Bevy's Camera2d over the default clear colour is the layered <Canvas3D>, in Bevy's
+// default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot } from "raea";
+import { Canvas3D } from "raea/3d";
+import { Node, Text, UiRect, percent, px } from "raea/ui";
+import { Srgba } from "raea/color";
+
+const GROUPS: [string, number[]][] = [["TabGroup 0", [0, 0, 0, 0]], ["TabGroup 2", [3, 2, 1, 0]], ["TabGroup 1", [0, 1, 2, 3]], ["Modal TabGroup", [0, 3, 1, 2]]];
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)" />
+ <Node width={percent(100)} height={percent(100)} display="Flex" flex_direction="Column" align_items="Center" justify_content="Center" row_gap={px(6)}>
+ {GROUPS.flatMap(([label, indices]) => [
+ <Text key={`${label}-label`}>{label}</Text>,
+ <Node key={label} display="Flex" flex_direction="Row" column_gap={px(6)} margin={UiRect.bottom(px(10))}>
+ {indices.map((i, k) => (
+ <Node key={k} width={px(200)} height={px(65)} border={UiRect.all(px(5))} justify_content="Center" align_items="Center" border_color={new Srgba(0, 0, 0)} background_color={new Srgba(0.15, 0.15, 0.15)}>
+ <Text font_size={{ Px: 20 }} color={new Srgba(0.9, 0.9, 0.9)}>{`TabIndex ${i}`}</Text>
+ </Node>
+ ))}
+ </Node>,
+ ])}
+ </Node>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);