## 語法

[in] double beginOffset,
[in] float  constantCoefficient,
[in] float  linearCoefficient,
[in] float  cubicCoefficient
);

## 參數

[in] beginOffset

[in] constantCoefficient

[in] linearCoefficient

[in] cubicCoefficient

## 備註

x (t) = atー + btー + ct + d

#### 範例

HRESULT DoAnimatedRotation(IDCompositionDevice *pDevice,
IDCompositionRotateTransform *pRotateTransform,
IDCompositionVisual *pVisual,
float animationTime)
{
HRESULT hr = S_OK;
IDCompositionAnimation *pAnimation = nullptr;

// Create an animation object.
hr = pDevice->CreateAnimation(&pAnimation);

if (SUCCEEDED(hr))
{
// Create the animation function by adding cubic polynomial segments.
// For a given time input (t), the output value is
// a*t^3 + b* t^2 + c*t + d.
//
// The following segment will rotate the visual clockwise.
0.0,                                // Begin offset
0.0,                                // Constant coefficient - d
(360.0f * 1.0f) / animationTime,    // Linear coefficient - c
0.0,                                // Quadratic coefficient - b
0.0);                               // Cubic coefficient - a

// The following segment will rotate the visual counterclockwise.
animationTime,
0.0,
-(360.0f * 1.0f) / animationTime,
0.0,
0.0);

// Set the end of the animation.
pAnimation->End(
2 * animationTime,  // End offset
0.0);               // End value

// Apply the animation to the Angle property of the
// rotate transform.
hr = pRotateTransform->SetAngle(pAnimation);
}

if (SUCCEEDED(hr))
{
// Apply the rotate transform object to a visual.
hr = pVisual->SetTransform(pRotateTransform);
}

if (SUCCEEDED(hr))
{
// Commit the changes to the composition.
hr = pDevice->Commit();
}

SafeRelease(&pAnimation);

return hr;
}

DLL Dcomp.dll

## 另請參閱

IDCompositionAnimation