IUIAnimationInterpolator2::SetDuration method (uianimation.h)

Sets the duration of the transition in the given dimension.

Syntax

HRESULT SetDuration(
  [in, out] UI_ANIMATION_SECONDS duration
);

Parameters

[in, out] duration

The duration of the transition.

Return value

Returns S_OK if successful; otherwise an HRESULT error code. See Windows Animation Error Codes for a list of error codes.

Remarks

Windows Animation calls this method only after calling the IUIAnimationInterpolator2::GetDependencies method, and only if that call returns UI_ANIMATION_DEPENDENCY_DURATION as one of its durationDependencies flags.

Typically, an interpolator with a duration dependency has a duration parameter in the IUIAnimationTransitionFactory or IUIAnimationTransitionFactory2 creation method that is associated with that interpolator. The interpolator should store its duration when first initialized and overwrite the duration when SetDuration is called.

Windows Animation always calls the IUIAnimationInterpolator2::SetInitialValueAndVelocity method to set the initial value and velocity before calling SetDuration, so a custom interpolator doesn't need to check whether the initial value and velocity have been set.

Windows Animation can call SetInitialValueAndVelocity and SetDuration multiple times with different parameters. Interpolators can cache internal state to improve performance, but they must update this cached state each time SetInitialValueAndVelocity is called and ensure that the results of subsequent calls to SetDuration reflect the updated state.

Requirements

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

See also

IUIAnimationInterpolator2

UI_ANIMATION_DEPENDENCIES

UI_ANIMATION_SECONDS