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.

Syntax

class CInterpolatorBase : public CUIAnimationInterpolatorBase<CInterpolatorBase>;  

Members

Public Constructors

Name Description
CInterpolatorBase::CInterpolatorBase Constructs the CInterpolatorBase object.

Public Methods

Name Description
CInterpolatorBase::CreateInstance Creates an instance of CInterpolatorBase and stores a pointer to custom interpolator, which will be handling events.
CInterpolatorBase::GetDependencies Gets the interpolator's dependencies. (Overrides CUIAnimationInterpolatorBase::GetDependencies.)
CInterpolatorBase::GetDuration Gets the interpolator's duration. (Overrides CUIAnimationInterpolatorBase::GetDuration.)
CInterpolatorBase::GetFinalValue Gets the final value to which the interpolator leads. (Overrides CUIAnimationInterpolatorBase::GetFinalValue.)
CInterpolatorBase::InterpolateValue Interpolates the value at a given offset (Overrides CUIAnimationInterpolatorBase::InterpolateValue.)
CInterpolatorBase::InterpolateVelocity Interpolates the velocity at a given offset (Overrides CUIAnimationInterpolatorBase::InterpolateVelocity.)
CInterpolatorBase::SetCustomInterpolator Stores a pointer to custom interpolator, which will be handling events.
CInterpolatorBase::SetDuration Sets the interpolator's duration (Overrides CUIAnimationInterpolatorBase::SetDuration.)
CInterpolatorBase::SetInitialValueAndVelocity Sets the interpolator's initial value and velocity. (Overrides CUIAnimationInterpolatorBase::SetInitialValueAndVelocity.)

Remarks

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.

Inheritance Hierarchy

CUIAnimationCallbackBase

CUIAnimationInterpolatorBase

CInterpolatorBase

Requirements

Header: afxanimationcontroller.h

CInterpolatorBase::CInterpolatorBase

Constructs the CInterpolatorBase object.

CInterpolatorBase();

CInterpolatorBase::CreateInstance

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

CInterpolatorBase::GetDependencies

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.

CInterpolatorBase::GetDuration

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.

CInterpolatorBase::GetFinalValue

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.

CInterpolatorBase::InterpolateValue

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.

CInterpolatorBase::InterpolateVelocity

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.

CInterpolatorBase::SetCustomInterpolator

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

void SetCustomInterpolator(CCustomInterpolator* pInterpolator);

Parameters

pInterpolator
A pointer to custom interpolator.

CInterpolatorBase::SetDuration

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.

CInterpolatorBase::SetInitialValueAndVelocity

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.

See Also

Classes