Skip to content

Exit transitions: animate a keyed node out before it leaves the tree #35

Open

Description

@samitbasu

Reported by the reference shell's port. The shell fades a panel out before unmounting it: shut panels unmount after the fade.

bullseye animates paint variants only on nodes that persist. A node that leaves the tree vanishes at once.

Proposal: an opt-in exit transition on keyed nodes, for example .exit(Fade | Slide(edge), Duration). When a keyed node with an exit transition disappears from the build, bullseye keeps painting its last frame's shapes, faded or translated, until the duration ends. It's paint-only and takes no input. This is the mirror of #30, which animates nodes moving, and generalises #21's slide-out for sheets.

State: the last frame's shapes and rect per exiting keyed node, kept for at most the duration, so it's bounded.

Tests: a removed node is still painted mid-exit and gone after; it receives no input while exiting; and re-adding it during the exit cancels the exit.

Activity

  1. added
    needs-decision
    on Nov 8, 2026
  2. samitbasu commented on Nov 10, 2026

    @samitbasu
    OwnerAuthor

    Decided (user, 2026-11-10): in v0.1, as ghosts. Scheduled after #70 and #69, before M5.

    Design

    • tw().exit(Exit::Fade, Duration) on an identified node, with Exit::Slide(Edge) as well, and Exit::FadeSlide if it's cheap. Easing comes from the existing ease_* classes, as for transition and animate_layout.
    • Each frame, bullseye records the painted shapes of nodes that have an exit: their clipped shapes, including the subtree, in the coordinates they were painted at. When such a key is missing from the next build, bullseye keeps painting those shapes (faded or translated) for the duration, then drops them.
    • No retained node: the node's closures have already run (FnOnce, 'f borrows), so only the shapes outlive their frame. Memory is bounded by the number of exiting nodes and the duration.
    • A ghost takes no input and is not in the layout. With Animate position changes of keyed nodes (FLIP) #30, the remaining siblings that opted into animate_layout slide into the gap while the ghost fades.
    • Re-added during its exit (an undo), the ghost is dropped at once and the live node paints normally. Never both.
    • Paint order: a ghost paints where its node was in its parent's paint order if that is cheap. Otherwise it paints after its former parent's children, so it stays inside the parent's clip. Decide in the PR and say which.
    • Window resize: ghosts are dropped, as Animate position changes of keyed nodes (FLIP) #30 drops animations on resize.
    • The same mechanism later gives sheets their slide-out (Sheets, drawers and slide-in sidebars #21).

    Tests

    • A removed node is painted mid-exit at its last place with decreasing opacity, and is gone after the duration.
    • It receives no clicks while exiting.
    • Re-adding it cancels the ghost.
    • Siblings with animate_layout slide into the gap while the ghost fades.
    • Nodes without .exit vanish at once.
    • No repaint is requested once no ghost is left.
    • .exit on an anonymous node is a debug build error.

    Demo: todo's Remove. The duration and look are for the user to try.

  3. samitbasu commented on Nov 10, 2026

    @samitbasu
    OwnerAuthor

    Correction: the user added ghosts (#35) to the plan. They did not decide it's in v0.1; that's still open. The design in the comment above stands. The scheduling note (after #70 and #69, before M5) is withdrawn until the release is decided.

  4. samitbasu commented on Nov 11, 2026

    @samitbasu
    OwnerAuthor

    Decided in the M6 design review (PR #101): overlays animate out by staying mounted (.shown()/.on_exited() on the overlay chain), so M6 doesn't depend on ghosts. This issue stays independent, for nodes whose data is already gone.

  5. added
    post-0.1
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-decisionpost-0.1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions