public record class ExitSpecHow long a subtree stays in the document after the thing that built it stopped wanting it.
Remarks
⚠ The entering half of an appearance animation is nearly free and the leaving half is the whole problem. An element that arrives can animate from a class the cascade applies on its first frame, because it is in the document to be cascaded over. An element that leaves has to still be in the document while it does — so Region.Clear, which removes synchronously and is what every @for row and @if arm ends through, has to be able to say not yet, and something has to own the interval. That is what this is: the interval, and the name of the class the author writes the transition against.
⚠ A duration rather than "until the animator stops", and that is a decision. The obvious alternative is to add the class, let the cascade resolve, and hold the elements until Animator reports nothing running on them. It reads better and it is the wrong instrument: nothing has cascaded at the moment a row leaves, so the answer on the first frame is "nothing is running" for a row whose transition is about to start and for a row that has none, and the two are indistinguishable. Waiting a frame to tell them apart makes the removal depend on when a style pass happened to run, which is exactly the class of test this repository has spent the most time de-flaking. A number the author states is deterministic, is the same number they already wrote in the stylesheet, and is asserted against frame counts driven by the test's own clock.
What it costs is that the number is written twice — once in transition: opacity 200ms and once here — and the failure when they disagree is benign in one direction (the row is removed mid-fade) and invisible in the other (the row sits at its final appearance for the remainder). Neither is a wrong picture that looks right, which is the bar.
Fields and properties (2)
public TimeSpan DurationHow long it is kept, measured on Now.
public string ClassThe class added to its top-level elements while it is on its way out.
Methods (1)
public ExitSpec(TimeSpan Duration, string Class = "leaving")How long a subtree stays in the document after the thing that built it stopped wanting it.
Used by (4)
- BuildContextVixen.Ui
- FadingVixen.Ui.Tests
- FadingRankedVixen.Ui.Tests
- RegionVixen.Ui