Edit

Share via


CCustomTransition Class

Implements a custom transition.

Syntax

class CCustomTransition : public CBaseTransition;

Members

Public Constructors

Name Description
CCustomTransition::CCustomTransition Constructs a custom transition object.

Public Methods

Name Description
CCustomTransition::Create Calls the transition library to create encapsulated transition COM object. (Overrides CBaseTransition::Create.)
CCustomTransition::SetInitialValue Sets an initial value, which will be applied to an animation variable associated with this transition.
CCustomTransition::SetInitialVelocity Sets an initial velocity, which will be applied to an animation variable associated with this transition.

Protected Data Members

Name Description
CCustomTransition::m_bInitialValueSpecified Specifies whether the initial value was specified with SetInitialValue.
CCustomTransition::m_bInitialVelocitySpecified Specifies whether the initial velocity was specified with SetInitialVelocity.
CCustomTransition::m_initialValue Stores the initial value.
CCustomTransition::m_initialVelocity Stores the initial velocity.
CCustomTransition::m_pInterpolator Stores a pointer to a custom interpolator.

Remarks

The CCustomTransitions class allows developers to implement custom transitions. It's created and used as a standard transition, but its constructor accepts as parameter a pointer to a custom interpolator. Perform the following steps to use custom transitions: 1. Derive a class from CCustomInterpolator and implement at least InterpolateValue method. 2. Ensure that the lifetime of custom interpolator object must be longer than duration of animation where it's used. 3. Instantiate (using operator new) a CCustomTransition object and pass a pointer to custom interpolator in the constructor. 4. Call CCustomTransition::SetInitialValue and CCustomTransition::SetInitialVelocity if these parameters are required for custom interpolation. 5. Pass the pointer to custom transition to AddTransition method of animation object, whose value should be animated with the custom algorithm. 6. When the value of animation object should change Windows Animation API will call InterpolateValue (and other relevant methods) in CCustomInterpolator.

Inheritance Hierarchy

CObject

CBaseTransition

CCustomTransition

Requirements

Header: afxanimationcontroller.h

CCustomTransition::CCustomTransition

Constructs a custom transition object.

CCustomTransition(CCustomInterpolator* pInterpolator);

Parameters

pInterpolator
A pointer to custom interpolator.

CCustomTransition::Create

Calls the transition library to create encapsulated transition COM object.

virtual BOOL Create(
    IUIAnimationTransitionLibrary* */,
    IUIAnimationTransitionFactory* pFactory);

Parameters

pFactory
A pointer to transition factory, which is responsible for creation of custom transitions.

Return Value

Remarks

This method also can set initial value and initial velocity to be applied to an animation variable, which is associated with this transition. For this purpose you have to call SetInitialValue and SetInitialVelocity before the framework creates the encapsulated transition COM object (it happens when you call CAnimationController::AnimateGroup).

CCustomTransition::m_bInitialValueSpecified

Specifies whether the initial value was specified with SetInitialValue.

BOOL m_bInitialValueSpecified;

CCustomTransition::m_bInitialVelocitySpecified

Specifies whether the initial velocity was specified with SetInitialVelocity.

BOOL m_bInitialVelocitySpecified;

CCustomTransition::m_initialValue

Stores the initial value.

DOUBLE m_initialValue;

CCustomTransition::m_initialVelocity

Stores the initial velocity.

DOUBLE m_initialVelocity;

CCustomTransition::m_pInterpolator

Stores a pointer to a custom interpolator.

CCustomInterpolator* m_pInterpolator;

CCustomTransition::SetInitialValue

Sets an initial value, which will be applied to an animation variable associated with this transition.

void SetInitialValue(DOUBLE initialValue);

Parameters

initialValue

CCustomTransition::SetInitialVelocity

Sets an initial velocity, which will be applied to an animation variable associated with this transition.

void SetInitialVelocity(DOUBLE initialVelocity);

Parameters

initialVelocity

See also

Classes