Skip to content
Development

Navigation paths ​

Following widget bounds ​

Attach FollowBounds to a widget to position it around another widget. It uses prepared LayoutGeometry outputs, including scrolling and transforms, and maps the target into the follower parent's coordinates. The follower does not occupy flex space; its children retain ordinary layout and padding.

FollowBounds
recipes.rs105 lines
780#[model]
781#[derive(Default)]
782pub struct SpringTabs {
783 #[observe]
784 pub active: u8,
785}
786
787#[event]
788fn pick_tab(
789 index: u8,
790 tabs: model!(SpringTabs),
791 target: entity!(),
792 followers: query!(mut FollowBounds),
793) {
794 tabs.set_active(index);
795 for follower in followers {
796 follower.target = target;
797 }
798}
799
800#[model]
801impl SpringTabs {
802 pub fn set_active(&mut self, index: u8) {
803 self.active = index;
804 }
805}
806
807#[compose]
808fn spring_scene(tabs: model!(SpringTabs), reduced: bool) {
809 ui! {
810 Column (
811 grow: 1.0,
812 padding: Padding::all(20),
813 justify: JustifyContent::SpaceBetween,
814 text_color: ColorToken::OnSurface
815 ) {
816 Text (
817 "Tap any pill — FollowBounds retargets mid-flight",
818 height: 22,
819 font_size: 13,
820 text_color: ColorToken::OnSurfaceVariant,
821 paragraph: ParagraphStyle::label().with_align(TextAlign::Start)
822 )
823 Row (
824 height: 52,
825 padding: Padding::all(5),
826 column_gap: 6,
827 align: AlignItems::Center,
828 bg_color: ColorToken::SurfaceVariant,
829 border_radius: 12
830 ) {
831 Button (
832 "MCU",
833 id: "spring_first",
834 grow: 1.0,
835 height: 38,
836 border_radius: 8,
837 normal_color: ColorToken::Surface,
838 pressed_color: ColorToken::SurfaceVariant,
839 text_color: ColorToken::OnSurface
840 ) on Tap(pick_tab::callback(0, tabs))
841 Button (
842 "Desktop",
843 grow: 1.4,
844 height: 38,
845 border_radius: 8,
846 normal_color: ColorToken::Surface,
847 pressed_color: ColorToken::SurfaceVariant,
848 text_color: ColorToken::OnSurface
849 ) on Tap(pick_tab::callback(1, tabs))
850 Button (
851 "Web",
852 grow: 1.0,
853 height: 38,
854 border_radius: 8,
855 normal_color: ColorToken::Surface,
856 pressed_color: ColorToken::SurfaceVariant,
857 text_color: ColorToken::OnSurface
858 ) on Tap(pick_tab::callback(2, tabs))
859 View (
860 id: "spring_ring",
861 border_width: 2,
862 border_color: ColorToken::Primary,
863 border_radius: 9
864 ) [
865 FollowBounds::new(id("spring_first"))
866 .with_transition(indicator_transition(reduced)),
867 ]
868 }
869 Text (
870 text: ${
871 match tabs.active() {
872 0 => "Target 01 · SPI framebuffer with dirty-rect clips",
873 1 => "Target 02 · Batched GPU draws with retained textures",
874 _ => "Target 03 · Browser canvas driven by requestAnimationFrame",
875 }
876 },
877 height: 20,
878 font_size: 12,
879 text_color: ColorToken::OnSurfaceVariant,
880 paragraph: ParagraphStyle::label().with_align(TextAlign::Start)
881 )
882 }
883 };
884}
Loading preview…

Tap across MCU, Desktop, and Web to retarget FollowBounds mid-flight with the INTERACTIVE spring.

rust
use mirui::prelude::*;
use mirui::ui::widgets::FollowBounds;

#[compose]
fn selection() {
    ui! {
        View (width: 240, height: 120) {
            View (id: "selected", width: 80, height: 40, bg_color: Color::rgb(30, 70, 120))
            View (border_width: 2, border_color: Color::rgb(80, 160, 240)) [
                FollowBounds::new(id("selected")).with_outset(3),
            ]
        }
    };
}

let mut app = App::headless(240, 120);
app.with_default_widgets();
let root = app.spawn_root().id();
app.compose(root, selection());
app.render().unwrap();

with_content(true) selects the target's content box after resolved padding. with_outset(value) expands the mapped rectangle; negative values inset it. with_offset(x, y) translates it. Both use the follower parent's logical coordinates. Rotation maps to an axis-aligned bounding rectangle rather than matching an arbitrary outline.

The follower respects its own ancestor clips and the target's ancestor clip. Hidden, deleted, detached, cyclic, or unmappable targets make the follower unavailable for drawing, input, and output reads until the relation becomes valid. Self-targets and targets inside the follower subtree are cyclic. Removing FollowBounds restores the authored Style; the component never overwrites that style. Use follow_bounds::view() for selective widget registration, or with_default_widgets() to include it automatically.

Bounds update immediately by default. Add .with_transition(mirui::anim::SNAPPY) or pass a TweenConfig to animate position and size changes. The first valid placement and recovery from an unavailable target are immediate. Retargeting preserves each axis's displayed position; springs also retain velocity. Rendering and hit testing use the displayed bounds, clipped to the current source viewport. transition: None or zero duration switches immediately. Only animated followers allocate motion component storage, prepared when animation is enabled; advancing and retargeting reuse it.

Simulating proximity in tests ​

Gallery's Nearby (nearby_demo) showcases FollowBounds, directional PageView deck slides, and retained modal overlays in a local handheld game launcher, paired with a deterministic proximity/network simulation inspector (F2 or Simulate above the Web canvas):

Simulation Control / FlowShortcut / TriggerBehavior & State Contract
Toggle Simulation InspectorF2 / Web SimulateExpands a scrollable 300 px inspector to the left of the 640×480 launcher without altering application state
Connection Flows & 9 Case PresetsJ or hold X / InspectorStarts game creation/joining, local matching, LAN, or direct entry across 9 presets (success, connection/restore failure, existing/no rooms, reconnecting, remote closure, no match, unsupported)
Step & Local ConfirmationDeliver reply / Local A / Local BDeliver reply advances one remote operation with an expected-result hint; Local A / Local B drive host approval and start confirmation through the active route
State-Gated Fault InjectionFault buttons / Repeat case / Stop caseInjects failure, timeout, host rejection, remote departure, connection loss, or restore results; Repeat case restarts the scenario and Stop case restores the retained launcher
Navigation & Deck ShortcutsTab / K / Y / XTab switches favorites & retained catalog; K opens settings/search keyboard; Y sorts/searches/switches themes; X launches on release or opens multiplayer on hold (cancelled if navigation intervenes)

Nearby starts with the forest palette (switching between forest, sunset, and night in settings) and plays ten bundled sound cues across navigation and connection transitions. Connection panels animate over the retained browser below, caching modal backgrounds within the shared offscreen budget, and returning from tools or completed simulations restores the exact catalog position and selection.

Interactive example ​

Page Studio is available in the Gallery's Showcase section as page_studio. Its collection, place details and note editor demonstrate stack navigation and retained controls; the scene panel demonstrates PageView. The toolbar separates None/Slide/Fade effects from Tween/Spring motion. Tween offers Linear, Ease out and Ease in-out at 300 ms; Spring offers Smooth, Snappy, Bouncy and Interactive. The Follow Bounds panel moves an independent outline between three differently sized buttons using FollowBounds; each selection uses the toolbar's current motion and preset.

sh
cargo run -p gallery --example page_studio_demo
cargo run -p gallery --example page_studio_demo --no-default-features --features wgpu

Run Nearby with SDL, SDL-GPU, or WGPU:

sh
cargo run -p gallery --example nearby_demo
cargo run -p gallery --example nearby_demo --no-default-features --features sdl-gpu
cargo run -p gallery --example nearby_demo --no-default-features --features wgpu

NavigationPath<R> is an observable Model containing pushed destinations. The root page is not part of the path. Register an instance with App::add_model or store it in an owned Model field.

rust
use mirui::app::App;
use mirui::ui::widgets::navigation::NavigationPath;

#[derive(Clone)]
enum Route {
    Devices,
    Device(u32),
}

let mut app = App::headless(320, 240);
let path = app
    .add_model(NavigationPath::<Route>::with_capacity(8))
    .finish();

path.push(Route::Devices).unwrap();
path.push(Route::Device(7)).unwrap();
assert_eq!(path.len(), 2);
path.pop().unwrap();
assert_eq!(path.len(), 1);
path.clear().unwrap();
assert!(path.is_empty());

len(), is_empty() and revision() are observable. Successful structural changes publish Model observations, including derived values on an owning parent Model. Removing from an empty path does not publish a change.

with_capacity(n) prepares storage for at most n destinations. push moves the destination into prepared storage; it does not grow storage or clone the route. Equal destinations are separate entries. pop and clear retain capacity. A rejected mutation leaves the path unchanged.

Retained navigation stacks ​

NavigationStack binds a path to a page factory. Its ordinary children are the root page; the factory handles every pushed destination. Register navigation::view::<Route>() once per route type, not once per page. Multiple independent navigation areas use separate path instances.

NavigationStack
recipes.rs146 lines
1840#[derive(Clone, Copy)]
1841enum StackRoute {
1842 Devices,
1843 Detail(u32),
1844}
1845
1846#[compose]
1847fn stack_devices_page(path: model!(NavigationPath<StackRoute>)) -> Entity {
1848 ui! {
1849 Column (
1850 grow: 1.0,
1851 padding: Padding::all(14),
1852 row_gap: 8,
1853 bg_color: ColorToken::SurfaceVariant,
1854 border_radius: 10
1855 ) {
1856 Text ("Pushed · Devices", height: 22, font_size: 15, text_color: ColorToken::Primary)
1857 Row (height: 34, column_gap: 8) {
1858 Button (
1859 "Inspect #7 →",
1860 grow: 1.0,
1861 height: 32,
1862 font_size: 12,
1863 border_radius: 7,
1864 normal_color: ColorToken::Primary,
1865 pressed_color: ColorToken::Secondary,
1866 text_color: ColorToken::OnPrimary
1867 ) on Tap { let _ = path.push(StackRoute::Detail(7)); }
1868 Button (
1869 "← Back",
1870 width: 76,
1871 height: 32,
1872 font_size: 12,
1873 border_radius: 7,
1874 normal_color: ColorToken::Surface,
1875 pressed_color: ColorToken::Outline,
1876 text_color: ColorToken::OnSurface
1877 ) on Tap { let _ = path.pop(); }
1878 }
1879 }
1880 }
1881}
1882
1883#[compose]
1884fn stack_detail_page(path: model!(NavigationPath<StackRoute>), id: u32) -> Entity {
1885 ui! {
1886 Column (
1887 grow: 1.0,
1888 padding: Padding::all(14),
1889 row_gap: 8,
1890 bg_color: ColorToken::Secondary,
1891 border_radius: 10
1892 ) {
1893 Text (
1894 text: ${ format_args!("Device #{id} · ESP32-C3") },
1895 capacity: 28,
1896 height: 22,
1897 font_size: 15,
1898 text_color: ColorToken::OnSecondary
1899 )
1900 Row (height: 34, column_gap: 8) {
1901 Button (
1902 "← Pop one",
1903 grow: 1.0,
1904 height: 32,
1905 font_size: 12,
1906 border_radius: 7,
1907 normal_color: ColorToken::Surface,
1908 pressed_color: ColorToken::Outline,
1909 text_color: ColorToken::OnSurface
1910 ) on Tap { let _ = path.pop(); }
1911 Button (
1912 "Clear root",
1913 width: 88,
1914 height: 32,
1915 font_size: 12,
1916 border_radius: 7,
1917 normal_color: ColorToken::Primary,
1918 pressed_color: ColorToken::Outline,
1919 text_color: ColorToken::OnPrimary
1920 ) on Tap { let _ = path.clear(); }
1921 }
1922 }
1923 }
1924}
1925
1926#[event]
1927fn build_stack_page(
1928 event: event!(StackCreatePage<StackRoute>),
1929 path: model!(NavigationPath<StackRoute>),
1930) -> Entity {
1931 match *event.route() {
1932 StackRoute::Devices => ui! { stack_devices_page(path) },
1933 StackRoute::Detail(id) => ui! { stack_detail_page(path, id) },
1934 }
1935}
1936
1937#[compose]
1938fn nav_stack_scene(path: model!(NavigationPath<StackRoute>), reduced: bool) {
1939 ui! {
1940 Column (
1941 grow: 1.0,
1942 padding: Padding::all(18),
1943 row_gap: 10,
1944 text_color: ColorToken::OnSurface
1945 ) {
1946 Text (
1947 text: ${ format_args!("Stack depth: {}", path.len()) },
1948 capacity: 24,
1949 height: 20,
1950 font_size: 12,
1951 text_color: ColorToken::OnSurfaceVariant,
1952 paragraph: ParagraphStyle::label().with_align(TextAlign::Start)
1953 )
1954 NavigationStack (
1955 path: path.clone(),
1956 grow: 1.0,
1957 transition: if reduced {
1958 PageTransition::None
1959 } else {
1960 PageTransition::slide(mirui::anim::SMOOTH)
1961 }
1962 ) {
1963 Column (
1964 grow: 1.0,
1965 padding: Padding::all(14),
1966 justify: JustifyContent::SpaceBetween,
1967 bg_color: ColorToken::SurfaceVariant,
1968 border_radius: 10
1969 ) {
1970 Text ("Root · Home page", height: 22, font_size: 15)
1971 Button (
1972 "Push Devices →",
1973 width: Dimension::percent(100),
1974 height: 34,
1975 font_size: 13,
1976 border_radius: 8,
1977 normal_color: ColorToken::Primary,
1978 pressed_color: ColorToken::Secondary,
1979 text_color: ColorToken::OnPrimary
1980 ) on Tap { let _ = path.push(StackRoute::Devices); }
1981 }
1982 } on CreatePage(build_stack_page::callback(path))
1983 }
1984 };
1985}
Loading preview…

Click Push Devices →, then Inspect #7 → to push two routes onto NavigationPath, and use ← Pop one or Clear root to slide back while retaining the root page's state.

rust
use mirui::prelude::*;
use mirui::ui::widgets::{Button, Text};
use mirui::ui::widgets::navigation::{self, CreatePage, NavigationPath, NavigationStack, PageTransition};
use mirui::anim::SMOOTH;

#[derive(Clone, Copy)]
enum Route { Devices, Device(u32), Settings }

#[compose]
fn shell(path: model!(NavigationPath<Route>)) -> Entity {
    ui! {
        NavigationStack(path: path.clone(), grow: 1.0,
            transition: PageTransition::slide(SMOOTH)) {
            Column(grow: 1.0) {
                Text("Home")
                Button(height: 40) [Text::label("Devices")]
                on Tap { path.push(Route::Devices).unwrap(); }
                Button(height: 40) [Text::label("Settings")]
                on Tap { path.push(Route::Settings).unwrap(); }
            }
        } on CreatePage(create_page::callback(path))
    }
}

#[event]
fn create_page(event: event!(CreatePage<Route>), path: model!(NavigationPath<Route>)) -> Entity {
    match *event.route() {
        Route::Devices => ui! { devices(path) },
        Route::Device(id) => ui! { detail(path, id) },
        Route::Settings => ui! { settings(path) },
    }
}

#[compose]
fn devices(path: model!(NavigationPath<Route>)) -> Entity {
    ui! {
        Column(grow: 1.0) {
            Text("Devices")
            Button(height: 40) [Text::label("Device 7")]
            on Tap { path.push(Route::Device(7)).unwrap(); }
            back(path)
        }
    }
}

#[compose]
fn detail(path: model!(NavigationPath<Route>), id: u32) -> Entity {
    ui! {
        Column(grow: 1.0) {
            Text(text: format!("Device {id}"))
            back(path)
        }
    }
}

#[compose]
fn settings(path: model!(NavigationPath<Route>)) -> Entity {
    ui! { Column(grow: 1.0) { Text("Settings") back(path) } }
}

#[compose]
fn back(path: model!(NavigationPath<Route>)) -> Entity {
    ui! {
        Button(height: 40) [Text::label("Back")]
        on Tap { path.pop().unwrap(); }
    }
}

fn main() {
    let mut app = App::headless(320, 240);
    app.with_default_widgets();
    app.with_widget(navigation::view::<Route>());
    let root = app.spawn_root().id();
    let path = app.add_model(NavigationPath::with_capacity(8)).finish();
    app.compose(root, shell(path.clone()));
    app.render().unwrap();
    path.push(Route::Devices).unwrap();
    app.render().unwrap();
    path.push(Route::Device(7)).unwrap();
    app.render().unwrap();
    path.pop().unwrap();
    app.render().unwrap();
}

Returning to a visited entry restores its existing widgets and scroll position. Hidden pages do not receive input; their reactive effects resume when shown. App-level systems remain installed. Removed entries release their page subtrees. An initial deep path constructs only its visible destination; an unvisited ancestor is constructed when first shown. A path can drive only one live stack; a second binding warns and remains on its root page.

Page creation may allocate, including cloning an owned route payload. Path mutation and unchanged-page coordination reuse prepared framework storage. A failed factory preserves the displayed page without retrying every frame; the next path revision or factory replacement permits another attempt. The application root and shared Models are not replaced by navigation.

Pages selected by application state ​

PageView follows an application value without keeping a history. Register its View once for each route type, then provide a CreatePage callback. The callback returns one newly constructed page root. Equal page values retain the existing subtree; a different value constructs its replacement before retiring the old subtree. Failed construction leaves the displayed page intact and is not retried until the selection or factory changes.

PageView
recipes.rs114 lines
1987#[derive(Clone, Copy, PartialEq, Eq, Default)]
1988pub enum ViewPage {
1989 #[default]
1990 Overview,
1991 Metrics,
1992 Logs,
1993}
1994
1995#[model]
1996#[derive(Default)]
1997pub struct ViewSession {
1998 #[observe]
1999 pub page: ViewPage,
2000}
2001
2002#[model]
2003impl ViewSession {
2004 pub fn select(&mut self, page: ViewPage) {
2005 self.page = page;
2006 }
2007}
2008
2009#[event]
2010fn create_view_page(event: event!(ViewCreatePage<ViewPage>)) -> Entity {
2011 match event.route() {
2012 ViewPage::Overview => ui! {
2013 Column (
2014 grow: 1.0,
2015 padding: Padding::all(16),
2016 justify: JustifyContent::Center,
2017 bg_color: ColorToken::SurfaceVariant,
2018 border_radius: 10
2019 ) {
2020 Text ("Overview · 160 MHz RISC-V", height: 24, font_size: 15, text_color: ColorToken::Primary)
2021 }
2022 },
2023 ViewPage::Metrics => ui! {
2024 Column (
2025 grow: 1.0,
2026 padding: Padding::all(16),
2027 justify: JustifyContent::Center,
2028 bg_color: ColorToken::Secondary,
2029 border_radius: 10
2030 ) {
2031 Text ("Metrics · Dirty flush 0.4 ms", height: 24, font_size: 15, text_color: ColorToken::OnSecondary)
2032 }
2033 },
2034 ViewPage::Logs => ui! {
2035 Column (
2036 grow: 1.0,
2037 padding: Padding::all(16),
2038 justify: JustifyContent::Center,
2039 bg_color: ColorToken::SurfaceVariant,
2040 border_radius: 10
2041 ) {
2042 Text ("Logs · 0 allocations in frame", height: 24, font_size: 15, text_color: ColorToken::OnSurface)
2043 }
2044 },
2045 }
2046}
2047
2048#[compose]
2049fn nav_pageview_scene(session: model!(ViewSession), reduced: bool) {
2050 ui! {
2051 Column (
2052 grow: 1.0,
2053 padding: Padding::all(18),
2054 row_gap: 10,
2055 text_color: ColorToken::OnSurface
2056 ) {
2057 Row (height: 32, column_gap: 6) {
2058 Button (
2059 "Overview",
2060 grow: 1.0,
2061 height: 30,
2062 font_size: 12,
2063 border_radius: 7,
2064 normal_color: ColorToken::SurfaceVariant,
2065 pressed_color: ColorToken::Outline,
2066 text_color: ColorToken::OnSurface
2067 ) on Tap { session.select(ViewPage::Overview); }
2068 Button (
2069 "Metrics",
2070 grow: 1.0,
2071 height: 30,
2072 font_size: 12,
2073 border_radius: 7,
2074 normal_color: ColorToken::SurfaceVariant,
2075 pressed_color: ColorToken::Outline,
2076 text_color: ColorToken::OnSurface
2077 ) on Tap { session.select(ViewPage::Metrics); }
2078 Button (
2079 "Logs",
2080 grow: 1.0,
2081 height: 30,
2082 font_size: 12,
2083 border_radius: 7,
2084 normal_color: ColorToken::Primary,
2085 pressed_color: ColorToken::Secondary,
2086 text_color: ColorToken::OnPrimary
2087 ) on Tap { session.select(ViewPage::Logs); }
2088 }
2089 PageView (
2090 page: ${ session.page() },
2091 grow: 1.0,
2092 transition: if reduced {
2093 PageTransition::None
2094 } else {
2095 PageTransition::slide(mirui::anim::SNAPPY)
2096 }
2097 ) on CreatePage(create_view_page::callback())
2098 }
2099 };
2100}
Loading preview…

Click Overview, Metrics, or Logs to switch session.page() and drive PageView with a SNAPPY slide transition.

rust
use mirui::prelude::*;
use mirui::ui::widgets::Text;
use mirui::ui::widgets::page_view::{self, CreatePage, PageView};

#[derive(Clone, Copy, PartialEq, Eq)]
enum Page { Home, Settings }

#[model]
struct Session {
    #[observe]
    page: Page,
}

#[model]
impl Session {
    fn show_settings(&mut self) { self.page = Page::Settings; }
}

#[event]
fn create_page(event: event!(CreatePage<Page>)) -> Entity {
    match event.route() {
        Page::Home => ui! { Text("Home", grow: 1.0) },
        Page::Settings => ui! { Text("Settings", grow: 1.0) },
    }
}

#[compose]
fn panel(session: model!(Session)) -> Entity {
    ui! {
        PageView(page: ${ session.page() }, grow: 1.0)
        on CreatePage(create_page::callback())
    }
}

fn main() {
    let mut app = App::headless(320, 240);
    app.with_default_widgets();
    app.with_widget(page_view::view::<Page>());
    let root = app.spawn_root().id();
    let session = app.add_model(Session { page: Page::Home }).finish();
    app.compose(root, panel(session.clone()));
    app.render().unwrap();
    session.show_settings();
    app.render().unwrap();
}

PageView::new(page) supports non-macro composition. Its page field stores Option<R>; None selects no page, and ordinary DSL field conversion accepts an R directly. Routes need Clone + PartialEq, not Default. Page construction can allocate; an unchanged selection does not clone its route or rebuild its widgets. The factory also accepts the ordinary inline closure and on CreatePage { ... } forms.

Page transitions ​

rust
use mirui::anim::{BOUNCY, Easing, Transition, TweenConfig, ease};
use mirui::types::Fixed;
use mirui::ui::widgets::navigation::{PageDirection, PageTransition};

const MOVE: TweenConfig = TweenConfig::new(300, &ease::OUT_CUBIC);
let slide = PageTransition::slide(MOVE);
let returning = PageTransition::slide(MOVE).with_direction(PageDirection::Backward);
let fade = PageTransition::fade(BOUNCY);

fn custom_progress(t: Fixed) -> Fixed { t * t }
static CUSTOM: Easing = Easing::new(custom_progress);
let config: Transition = TweenConfig::new(240, &CUSTOM).into();
let mut motion = config.motion(Fixed::ZERO, Fixed::ONE);
motion.tick(16);
config.retarget(&mut motion, Fixed::from_int(2));

transition: ${ expression } binds the transition configuration reactively on either container. Changes apply to subsequent transitions; active motion keeps its current configuration and velocity.

FollowBounds::with_transition and PageTransition::slide / fade accept the shared anim::Transition configuration. Transition::Tween(TweenConfig) and Transition::Spring(SpringConfig) select the motion algorithm; either configuration converts directly. TweenConfig::new(300, &ease::OUT_CUBIC) selects a 300 ms tween; SMOOTH, SNAPPY, BOUNCY, and INTERACTIVE are spring presets. The configuration creates and redirects existing Motion state; page effects determine how its value is applied to the page subtrees.

Followed bounds reconcile through the registered View during layout preparation, before drawing and input. Position and clipping changes reuse the prepared layout; size changes settle through the existing bounded layout loop. Inactive relation plans release their storage, and hidden relations retain an empty plan without repeated allocation.

Both containers accept transition: PageTransition::slide(config) or PageTransition::fade(config), using either tween or spring configuration. The default is PageTransition::None; first mount and configurations with zero duration switch immediately. Stack pushes and returns automatically slide in opposite directions. PageView defaults to forward movement without inferring navigation history.

Use PageTransition::slide(config).with_direction(PageDirection::Backward) to enter from the left and move the current page to the right; Forward does the opposite. The explicit direction overrides the container's automatic direction. Bind the complete configuration through the existing transition: ${state.transition()} property and update it with the page in one Model operation. Direction changes alone do not replace a page or alter an active pair. Returning to either member of that pair redirects the existing motion; a pending third page uses the latest configuration when its transition starts. Fade and None ignore direction.

Repeated targets with unchanged configuration do not restart motion. Tween redirection starts at the displayed value over the full configured duration, without inheriting velocity. Spring redirection preserves position and velocity. Changing algorithms starts the selected motion at the displayed value. Page containers retain the active transition's configuration through reversal; property changes apply to the next transition. FollowBounds applies configuration changes to its current motion. Loop and ping-pong modes remain available for ordinary animations, not finite transitions.

Transitions finish when the shared Motion completes: at the tween's duration or when the spring settles. Reversing the active pair redirects its motion without rebuilding either page. Other changes retain only the latest destination until the pair finishes. Both transitioning pages reject input; the selected page resumes input when the transition completes. Page-local transforms remain intact, and slide offsets follow the current container size. Slide retains overshoot within the clipped viewport; fade clamps only the composited opacity.

Slide requires no pixel buffers. Fade composites complete subtrees using the offscreen pool configured through app.with_offscreen_pool_budget(bytes). Two W × H RGBA buffers at scale 1 require 8 × W × H pixel bytes, in addition to other retained outputs and metadata. Insufficient storage or unsupported output composition logs a warning and completes the page switch without animation; it does not increase the budget.

Sliding a page retains unchanged local offscreen content. Moving a cached child inside another capture invalidates the containing capture, while edits to the child's content invalidate both. Dirty-region queries retain pending damage without rebuilding unchanged textures.