Resources | Resources |



Transitions and transition manager

Transitions apply a given effect, such as fading or motion over a period of time.

The ITransition2 interface is used to apply transitions to widgets. The ITransition2 interface can be used to schedule events or as a gradual modifier of a property, providing a special visual effect to the object it wraps. For example, a transition could create the effect of an object disappearing into a cloud of smoke.

ITransition2 provides five basic transitions by default:

  • fader transition
  • mover transition
  • scaler transition
  • scroller transition
  • resizer transition

Each transition implementation is defined by its effect. For example, the mover transition has the effect of moving a wrapped object from one point to another over a specific period of time. Likewise, the fader transition adjusts the transparency of a wrapped object, over some period of time (often used for fade-out or fade-in effects).

ITransition2 provides functions for stepping a transition effect and supplying notification at the completion of a transition effect. A transition is a passive object; it does not do anything on its own. To progress through a transition, it must be inserted in a transition manager or be manually stepped by an application. The transition manager is responsible for sending the step events to the transition.

How transitions work

To show how transitions work, this section describes how a flick event on a list is handled, illustrated in the figure below.

When the list container's touch controller receives a pointer up event, it queries the touch observer (attached to the root container) whether a flick occurred and what characteristics it had.

If the touch observer responds that a flick did occur, the list touch controller creates a scroller transition and configures it with the flick characteristics from the touch observer. It then sets the list container as the target for that transition and inserts the scroller transition into the transition manager. At regular intervals, the transition manager makes calls to the scroller transition step function. The interval between calls is configurable.

The transition updates the offset of the list. These frequent, small updates to the list give the impression that the list is scrolling.