IDCompositionAnimation::SetAbsoluteBeginTime method

Sets the absolute time at which the animation function starts.


HRESULT SetAbsoluteBeginTime(




The starting time for this animation.

Return Value


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


By default, an animation function starts when the first frame of the animation takes effect. For example, if an application creates a simple animation function with a single primitive at offset zero, associates the animation with some property, and then calls the IDCompositionDevice::Commit method, the first frame that includes the commit samples the animation at offset zero for the first primitive.

This implies that the actual default start time of all animations varies depending on the time between when the application creates the animation and calls Commit, to the time it takes the composition engine to pick up the committed changes. The application can use the SetAbsoluteBeginTime method to exercise finer control over the starting time of an animation.

This method does not control when animations take effect; it only affects how animations are sampled after they start. If the application specifies the exact time of the next frame as the absolute begin time, the result is the same as not calling this method at all. If the specified begin time is different from the time of the next frame, the result is one of following:

  • If the specified time is later than the next frame time, the animation start is delayed until the specified begin time.
  • If the specified time is earlier than the next frame time, the beginning of the animation is dropped and sampling starts into the animation function.


Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header dcompanimation.h
Library Dcomp.lib
DLL Dcomp.dll

See Also