Edit

Share via


CCustomInterpolator Class

Implements a basic interpolator.

Syntax

class CCustomInterpolator;

Members

Public Constructors

Name Description
CCustomInterpolator::CCustomInterpolator Overloaded. Constructs a custom interpolator object and initializes duration and velocity to specified values.

Public Methods

Name Description
CCustomInterpolator::GetDependencies Gets the interpolator's dependencies.
CCustomInterpolator::GetDuration Gets the interpolator's duration.
CCustomInterpolator::GetFinalValue Gets the final value to which the interpolator leads.
CCustomInterpolator::Init Initializes duration and final value.
CCustomInterpolator::InterpolateValue Interpolates the value at a given offset.
CCustomInterpolator::InterpolateVelocity Interpolates the velocity at a given offset
CCustomInterpolator::SetDuration Sets the interpolator's duration.
CCustomInterpolator::SetInitialValueAndVelocity Sets the interpolator's initial value and velocity.

Protected Data Members

Name Description
CCustomInterpolator::m_currentValue The interpolated value.
CCustomInterpolator::m_currentVelocity The interpolated velocity.
CCustomInterpolator::m_duration The duration of the transition.
CCustomInterpolator::m_finalValue The final value of a variable at the end of the transition.
CCustomInterpolator::m_initialValue The value of the variable at the start of the transition.
CCustomInterpolator::m_initialVelocity The velocity of the variable at the start of the transition.

Remarks

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.

Inheritance Hierarchy

CCustomInterpolator

Requirements

Header: afxanimationcontroller.h

CCustomInterpolator::CCustomInterpolator

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.

CCustomInterpolator::GetDependencies

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.

CCustomInterpolator::GetDuration

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.

CCustomInterpolator::GetFinalValue

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.

CCustomInterpolator::Init

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.

CCustomInterpolator::InterpolateValue

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.

CCustomInterpolator::InterpolateVelocity

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.

CCustomInterpolator::m_currentValue

The interpolated value.

DOUBLE m_currentValue;

CCustomInterpolator::m_currentVelocity

The interpolated velocity.

DOUBLE m_currentVelocity;

CCustomInterpolator::m_duration

The duration of the transition.

UI_ANIMATION_SECONDS m_duration;

CCustomInterpolator::m_finalValue

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

DOUBLE m_finalValue;

CCustomInterpolator::m_initialValue

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

DOUBLE m_initialValue;

CCustomInterpolator::m_initialVelocity

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

DOUBLE m_initialVelocity;

CCustomInterpolator::SetDuration

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.

CCustomInterpolator::SetInitialValueAndVelocity

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.

See also

Classes