IUIAnimationTransitionLibrary::CreateAccelerateDecelerateTransition method (uianimation.h)

Creates an accelerate-decelerate transition.

Syntax

HRESULT CreateAccelerateDecelerateTransition(
  [in]  UI_ANIMATION_SECONDS   duration,
  [in]  DOUBLE                 finalValue,
  [in]  DOUBLE                 accelerationRatio,
  [in]  DOUBLE                 decelerationRatio,
  [out] IUIAnimationTransition **transition
);

Parameters

[in] duration

The duration of the transition.

[in] finalValue

The value of the animation variable at the end of the transition.

[in] accelerationRatio

The ratio of the time spent accelerating to the duration.

[in] decelerationRatio

The ratio of the time spent decelerating to the duration.

[out] transition

The new accelerate-decelerate transition.

Return value

If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. See Windows Animation Error Codes for a list of error codes.

Remarks

During an accelerate-decelerate transition, the animation variable speeds up and then slows down over the duration of the transition, ending at a specified value. You can control how quickly the variable accelerates and decelerates independently, by specifying different acceleration and deceleration ratios.

When the initial velocity is zero, the acceleration ratio is the fraction of the duration that the variable will spend accelerating; likewise with the deceleration ratio. If the initial velocity is nonzero, it is the fraction of the time between the velocity reaching zero and the end of transition. The acceleration ratio and the deceleration ratio should sum to a maximum of 1.0.

The figures below show the effect on animation variables with different initial velocities during accelerate-decelerate transitions.

Diagram showing accelerate-decelerate transitions
Note  d' in the above figure on the right shows the time between the velocity reaching zero and the end of the transition.
 

Examples

For an example, see Create a Storyboard and Add Transitions.

Requirements

Requirement Value
Minimum supported client Windows 7, Windows Vista and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server None supported
Target Platform Windows
Header uianimation.h
DLL UIAnimation.dll

See also

IUIAnimationTransition

IUIAnimationTransitionLibrary