CCustomInterpolator 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 CCustomInterpolator Class.

Implements a basic interpolator.

class CCustomInterpolator;  

Public Constructors

NameDescription
CCustomInterpolator::CCustomInterpolatorOverloaded. Constructs a custom interpolator object and initializes duration and velocity to specified values.

Public Methods

NameDescription
CCustomInterpolator::GetDependenciesGets the interpolator's dependencies.
CCustomInterpolator::GetDurationGets the interpolator's duration.
CCustomInterpolator::GetFinalValueGets the final value to which the interpolator leads.
CCustomInterpolator::InitInitializes duration and final value.
CCustomInterpolator::InterpolateValueInterpolates the value at a given offset.
CCustomInterpolator::InterpolateVelocityInterpolates the velocity at a given offset
CCustomInterpolator::SetDurationSets the interpolator's duration.
CCustomInterpolator::SetInitialValueAndVelocitySets the interpolator's initial value and velocity.

Protected Data Members

NameDescription
CCustomInterpolator::m_currentValueThe interpolated value.
CCustomInterpolator::m_currentVelocityThe interpolated velocity.
CCustomInterpolator::m_durationThe duration of the transition.
CCustomInterpolator::m_finalValueThe final value of a variable at the end of the transition.
CCustomInterpolator::m_initialValueThe value of the variable at the start of the transition.
CCustomInterpolator::m_initialVelocityThe velocity of the variable at the start of the transition.

Derive a class from CCustomInterpolator and override all necessary methods in order to implement a custom interpolation algorithm. A pointer to this class should be passed as a parameter to CCustomTransition.

CCustomInterpolator

Header: afxanimationcontroller.h

Constructs a custom interpolator object and sets all values to default 0.

CCustomInterpolator();

 
CCustomInterpolator(
    UI_ANIMATION_SECONDS duration,  
    DOUBLE finalValue);

Parameters

duration
The duration of the transition.

finalValue

Remarks

Use CCustomInterpolator::Init to initialize duration and final value later in the code.

Gets the interpolator's dependencies.

virtual BOOL GetDependencies(
    UI_ANIMATION_DEPENDENCIES* initialValueDependencies,  
    UI_ANIMATION_DEPENDENCIES* initialVelocityDependencies,  
    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

Basic implementation always returns TRUE. Return FALSE from overridden implementation if you wish to fail the event.

Gets the interpolator's duration.

virtual BOOL GetDuration(UI_ANIMATION_SECONDS* duration);

Parameters

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

Return Value

Basic implementation always returns TRUE. Return FALSE from overridden implementation if you wish to fail the event.

Gets the final value to which the interpolator leads.

virtual BOOL GetFinalValue(DOUBLE* value);

Parameters

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

Return Value

Basic implementation always returns TRUE. Return FALSE from overridden implementation if you wish to fail the event.

Initializes duration and final value.

void Init(
    UI_ANIMATION_SECONDS duration,  
    DOUBLE finalValue);

Parameters

duration
The duration of the transition.

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

Interpolates the value at a given offset.

virtual BOOL InterpolateValue(
    UI_ANIMATION_SECONDS */,  
    DOUBLE* value);

Parameters

value
Output. The interpolated value.

Return Value

Basic implementation always returns TRUE. Return FALSE from overridden implementation if you wish to fail the event.

Interpolates the velocity at a given offset

virtual BOOL InterpolateVelocity(
    UI_ANIMATION_SECONDS */,  
    DOUBLE* velocity);

Parameters

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

Return Value

Basic implementation always returns TRUE. Return FALSE from overridden implementation if you wish to fail the event.

The interpolated value.

DOUBLE m_currentValue;  

The interpolated velocity.

DOUBLE m_currentVelocity;  

The duration of the transition.

UI_ANIMATION_SECONDS m_duration;  

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

DOUBLE m_finalValue;  

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

DOUBLE m_initialValue;  

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

DOUBLE m_initialVelocity;  

Sets the interpolator's duration.

virtual BOOL SetDuration(UI_ANIMATION_SECONDS duration);

Parameters

duration
The duration of the transition.

Return Value

Basic implementation always returns TRUE. Return FALSE from overridden implementation if you wish to fail the event.

Sets the interpolator's initial value and velocity.

virtual BOOL SetInitialValueAndVelocity(
    DOUBLE initialValue,  
    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

The basic implementation always returns TRUE. Return FALSE from overridden implementation if you wish to fail the event.

Classes

Show: