Export (0) Print
Expand All

Physics Engine Overview

Windows Mobile 6.5
4/8/2010

The physics engine calculates well defined animation points in response to a touch gesture. Since the animations are calculated in a central engine, gesture animations can be consistent across a system. The engine calculates animations only for two-dimensional scrolling in response to a gesture.

The physics engine works by generating a stream of animation points when given animation information, such as the initial speed and angle of the animation, as well as information about how the animation should handle boundary conditions. You can request the animation point at any time during the lifetime of the animation.

If you want to build an animation plan in advance, you can provide a set of timestamps to the engine and receive the set of animation points that correspond to those time stamps. You can also use this method to reproduce specific tests of your animations.

When you use a physics engine, you must create a separate instance of the physics engine object for each set of animation points.

The physics engine is based on the concept of a boundary and a viewable region. The boundary is a logical rectangle that represents the entire control. The viewable region is the portion of the control that is visible at any given time.

Animations have a velocity and a direction that determine how the viewable region moves in relation to the boundary. An animation can cause the viewable region to move to the limits of the boundary. When this happens, a boundary animation, if specified, occurs.

Boundary animations can be one of the following types:

  • Rubber band. The viewable region temporarily moves outside the boundary and then snaps back to the boundary, resulting in a rubber band effect.
  • None. The viewable region comes to a hard stop when the boundary edge is reached.

At the end of an animation, it is possible for items in a control to appear truncated, depending on where the animation stops.

If the items in a control are all the same fixed size, you can specify the item size when creating the physics engine. The physics engine will calculate stopping points for an animation based on the fixed size of the items, so that the viewable region will align with the item edges when the animation stops.

Community Additions

ADD
Show:
© 2014 Microsoft