ViewTransition Class

A view transition (https://drafts.csswg.org/css-view-transitions-1/#viewtransition): the animated transition between two states of a document. The old state is captured at the rendering opportunity that follows Document.StartViewTransition, the update callback then changes the document, and the tree of ::view-transition pseudo-elements, which shows the snapshots of the old state and the live images of the new state, is animated until its animations finish.

public sealed class ViewTransition

Properties

NameDescription
FinishedGets a task completed when the end state is visible: the animations finished or the transition was skipped. It only fails when the update callback failed (https://drafts.csswg.org/css-view-transitions-1/#dom-viewtransition-finished).
ReadyGets a task completed when the pseudo-elements of the transition are created and the animations are about to start; it fails when the transition cannot begin or is skipped before (https://drafts.csswg.org/css-view-transitions-1/#dom-viewtransition-ready).
TransitionRootGets the element that hosts the transition: the document element (https://drafts.csswg.org/css-view-transitions-2/#dom-viewtransition-transitionroot).
TypesGets the types of the transition, matched by :active-view-transition-type() (https://drafts.csswg.org/css-view-transitions-2/#dom-viewtransition-types).
UpdateCallbackDoneGets a task completed when the promise returned by the update callback is fulfilled; it fails when the promise is rejected (https://drafts.csswg.org/css-view-transitions-1/#dom-viewtransition-updatecallbackdone).

Gets a task completed when the end state is visible: the animations finished or the transition was skipped. It only fails when the update callback failed (https://drafts.csswg.org/css-view-transitions-1/#dom-viewtransition-finished).

public Task Finished { get; }

Gets a task completed when the pseudo-elements of the transition are created and the animations are about to start; it fails when the transition cannot begin or is skipped before (https://drafts.csswg.org/css-view-transitions-1/#dom-viewtransition-ready).

public Task Ready { get; }

TransitionRoot

ViewTransition.cs

Gets the element that hosts the transition: the document element (https://drafts.csswg.org/css-view-transitions-2/#dom-viewtransition-transitionroot).

public Element? TransitionRoot { get; }

Gets the types of the transition, matched by :active-view-transition-type() (https://drafts.csswg.org/css-view-transitions-2/#dom-viewtransition-types).

public ViewTransitionTypeSet Types { get; }

UpdateCallbackDone

ViewTransition.cs

Gets a task completed when the promise returned by the update callback is fulfilled; it fails when the promise is rejected (https://drafts.csswg.org/css-view-transitions-1/#dom-viewtransition-updatecallbackdone).

public Task UpdateCallbackDone { get; }

Methods

NameDescription
SkipTransition()Finishes the transition immediately, or prevents it from starting; the update callback is still called (https://drafts.csswg.org/css-view-transitions-1/#dom-viewtransition-skiptransition).
WaitUntil(Task<object?>)Delays the end of the transition until the task completes (https://drafts.csswg.org/css-view-transitions-2/#dom-viewtransition-waituntil).

SkipTransition()

ViewTransition.cs

Finishes the transition immediately, or prevents it from starting; the update callback is still called (https://drafts.csswg.org/css-view-transitions-1/#dom-viewtransition-skiptransition).

public void SkipTransition()

WaitUntil(Task<object?>)

ViewTransition.cs

Delays the end of the transition until the task completes (https://drafts.csswg.org/css-view-transitions-2/#dom-viewtransition-waituntil).

public void WaitUntil(Task<object?> promise)