CInterpolatorBase Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CInterpolatorBase Class.

Implements a callback, which is called by the Animation API when it has to calculate a new value of an animation variable.

class CInterpolatorBase : public CUIAnimationInterpolatorBase<CInterpolatorBase>;  

Public Constructors

NameDescription
CInterpolatorBase::CInterpolatorBaseConstructs the CInterpolatorBase object.

Public Methods

NameDescription
CInterpolatorBase::CreateInstanceCreates an instance of CInterpolatorBase and stores a pointer to custom interpolator, which will be handling events.
CInterpolatorBase::GetDependenciesGets the interpolator's dependencies. (Overrides CUIAnimationInterpolatorBase::GetDependencies.)
CInterpolatorBase::GetDurationGets the interpolator's duration. (Overrides CUIAnimationInterpolatorBase::GetDuration.)
CInterpolatorBase::GetFinalValueGets the final value to which the interpolator leads. (Overrides CUIAnimationInterpolatorBase::GetFinalValue.)
CInterpolatorBase::InterpolateValueInterpolates the value at a given offset (Overrides CUIAnimationInterpolatorBase::InterpolateValue.)
CInterpolatorBase::InterpolateVelocityInterpolates the velocity at a given offset (Overrides CUIAnimationInterpolatorBase::InterpolateVelocity.)
CInterpolatorBase::SetCustomInterpolatorStores a pointer to custom interpolator, which will be handling events.
CInterpolatorBase::SetDurationSets the interpolator's duration (Overrides CUIAnimationInterpolatorBase::SetDuration.)
CInterpolatorBase::SetInitialValueAndVelocitySets the interpolator's initial value and velocity. (Overrides CUIAnimationInterpolatorBase::SetInitialValueAndVelocity.)

This handler is created and passed to IUIAnimationTransitionFactory::CreateTransition when a CCustomTransition object is being created as a part of animation initialization process (started by CAnimationController::AnimateGroup). Usually you don't need to use this class directly, it just routs all events to a CCustomInterpolator-derived class, whose pointer is passed to constructor of CCustomTransition.

CUIAnimationCallbackBase

CUIAnimationInterpolatorBase

CInterpolatorBase

Header: afxanimationcontroller.h

Constructs the CInterpolatorBase object.

CInterpolatorBase();

Creates an instance of CInterpolatorBase and stores a pointer to custom interpolator, which will be handling events.

static COM_DECLSPEC_NOTHROW HRESULT CreateInstance(
    CCustomInterpolator* pInterpolator,  
    IUIAnimationInterpolator** ppHandler);

Parameters

pInterpolator
A pointer to custom interpolator.

ppHandler
Output. Contains a pointer to instance of CInterpolatorBase when the function returns.

Return Value

Gets the interpolator's dependencies.

IFACEMETHOD(GetDependencies)(
    __out UI_ANIMATION_DEPENDENCIES* initialValueDependencies,
    __out UI_ANIMATION_DEPENDENCIES* initialVelocityDependencies,
    __out UI_ANIMATION_DEPENDENCIES* durationDependencies);

Parameters

initialValueDependencies
Output. Aspects of the interpolator that depend on the initial value passed to SetInitialValueAndVelocity.

initialVelocityDependencies
Output. Aspects of the interpolator that depend on the initial velocity passed to SetInitialValueAndVelocity.

durationDependencies
Output. Aspects of the interpolator that depend on the duration passed to SetDuration.

Return Value

If the method succeeds, it returns S_OK. It returns E_FAIL if CCustomInterpolator is not set, or custom implementation returns FALSE from the GetDependencies method.

Gets the interpolator's duration.

IFACEMETHOD(GetDuration)(__out UI_ANIMATION_SECONDS* duration);

Parameters

duration
Output. The duration of the transition, in seconds.

Return Value

If the method succeeds, it returns S_OK. It returns E_FAIL if CCustomInterpolator is not set, or custom implementation returns FALSE from the GetDuration method.

Gets the final value to which the interpolator leads.

IFACEMETHOD(GetFinalValue)(__out DOUBLE* value);

Parameters

value
Output. The final value of a variable at the end of the transition.

Return Value

If the method succeeds, it returns S_OK. It returns E_FAIL if CCustomInterpolator is not set, or custom implementation returns FALSE from the GetFinalValue method.

Interpolates the value at a given offset

IFACEMETHOD(InterpolateValue)(
  __in UI_ANIMATION_SECONDS offset, 
  __out DOUBLE* value);

Parameters

offset
The offset from the start of the transition. The offset is always greater than or equal to zero and less than the duration of the transition. This method is not called if the duration of the transition is zero.

value
Output. The interpolated value.

Return Value

If the method succeeds, it returns S_OK. It returns E_FAIL if CCustomInterpolator is not set, or custom implementation returns FALSE from the InterpolateValue method.

Interpolates the velocity at a given offset

IFACEMETHOD(InterpolateVelocity)(
  __in UI_ANIMATION_SECONDS offset,
  __out DOUBLE* velocity);

Parameters

offset
The offset from the start of the transition. The offset is always greater than or equal to zero and less than or equal to the duration of the transition. This method is not called if the duration of the transition is zero.

velocity
Output. The velocity of the variable at the offset.

Return Value

If the method succeeds, it returns S_OK. It returns E_FAIL if CCustomInterpolator is not set, or custom implementation returns FALSE from the InterpolateVelocity method.

Stores a pointer to custom interpolator, which will be handling events.

void SetCustomInterpolator(CCustomInterpolator* pInterpolator);

Parameters

pInterpolator
A pointer to custom interpolator.

Sets the interpolator's duration

IFACEMETHOD(SetDuration)(__in UI_ANIMATION_SECONDS duration);

Parameters

duration
The duration of the transition.

Return Value

If the method succeeds, it returns S_OK. It returns E_FAIL if CCustomInterpolator is not set, or custom implementation returns FALSE from the SetDuration method.

Sets the interpolator's initial value and velocity.

IFACEMETHOD(SetInitialValueAndVelocity)(
  __in DOUBLE initialValue, 
  __in DOUBLE initialVelocity);

Parameters

initialValue
The value of the variable at the start of the transition.

initialVelocity
The velocity of the variable at the start of the transition.

Return Value

If the method succeeds, it returns S_OK. It returns E_FAIL if CCustomInterpolator is not set, or custom implementation returns FALSE from the SetInitialValueAndVelocity method.

Classes

Show: