Physics Engine Overview (Windows Embedded CE 6.0)
1/6/2010
The physics engine calculates well-defined animation points in response to a touch gesture. Because gesture animations are calculated in a central physics engine, the animations can be consistent across a system. The engine only calculates animations that relate to scrolling in 1 or 2 dimensions in response to a gesture.
The physics engine generates a stream of animation points when given animation information, such as the initial velocity and angle of the animation, and information about how the animation handles 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. For more information about setting your own timestamps, see the SetPhysicsEngineUserTime function.
When you use a physics engine, you must create a separate instance of the physics engine object for each set of animation points.
Boundaries and Viewable Regions
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 outside of the boundary. When this happens, the physics engine creates a boundary animation, if one is specified.
Boundary animations can be one of the following types:
- Rubber band The viewable region temporarily moves outside of the boundary and then snaps back to the boundary.
- Bounce The viewable region bounces away from the boundary edge and then back, stopping on the boundary edge.
- None The viewable region comes to a hard stop when it reaches the boundary edge.
- You set the boundary animation type in the PHYSICSENGINEINIT structure when you create a physics engine by using the CreatePhysicsEngine function.
Animation Stopping Points
At the end of an animation, items in a control may 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 in the PHYSICSENGINEINIT structure when you create the physics engine. The physics engine calculates stopping points for an animation based on the fixed size of the items, so that the viewable region aligns with the item edges when the animation stops.
Requirements
Header | pwinuser.h |