WinJS.UI.Animation.crossFade function

Performs an animation that fades an item or items in, fading out existing items that occupy the same space.

The following video demonstrates this animation:

Syntax

WinJS.UI.Animation.crossFade(incoming, outgoing).done( /* Your success and error handlers */ );

Parameters

  • incoming
    Type: Object

    Element or elements being faded in.

  • outgoing
    Type: Object

    Element or elements being replaced.

Return value

Type: Promise**

An object that completes when the animation has finished.

Remarks

The parameters of this function can be expressed in several ways:

  • As the special value "undefined", which means that the animation has no such target
  • As a single object
  • As a JavaScript array (possibly empty), in which each element of the array can be a single element or a JavaScript array of elements.
  • As a NodeList (for example, the result of querySelectorAll)
  • As an HTMLCollection

If you want to remove an element involved in this animation from the document altogether, doing so before the animation is complete causes the animation to abruptly stop. You should use the Promise to be notified when the animation completes and then remove the element from the document.

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.UI.Animation

See also

Animating fades

Guidelines and checklist for fade animations

HTML animation library sample