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

Implements a custom transition.

class CCustomTransition : public CBaseTransition;  

Public Constructors

NameDescription
CCustomTransition::CCustomTransitionConstructs a custom transition object.

Public Methods

NameDescription
CCustomTransition::CreateCalls the transition library to create encapsulated transition COM object. (Overrides CBaseTransition::Create.)
CCustomTransition::SetInitialValueSets an initial value, which will be applied to an animation variable associated with this transition.
CCustomTransition::SetInitialVelocitySets an initial velocity, which will be applied to an animation variable associated with this transition.

Protected Data Members

NameDescription
CCustomTransition::m_bInitialValueSpecifiedSpecifies whether the initial value was specified with SetInitialValue.
CCustomTransition::m_bInitialVelocitySpecifiedSpecifies whether the initial velocity was specified with SetInitialVelocity.
CCustomTransition::m_initialValueStores the initial value.
CCustomTransition::m_initialVelocityStores the initial velocity.
CCustomTransition::m_pInterpolatorStores a pointer to a custom interpolator.

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.

CObject

CBaseTransition

CCustomTransition

Header: afxanimationcontroller.h

Constructs a custom transition object.

CCustomTransition(CCustomInterpolator* pInterpolator);

Parameters

pInterpolator
A pointer to custom interpolator.

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).

Specifies whether the initial value was specified with SetInitialValue.

BOOL m_bInitialValueSpecified;  

Specifies whether the initial velocity was specified with SetInitialVelocity.

BOOL m_bInitialVelocitySpecified;  

Stores the initial value.

DOUBLE m_initialValue;  

Stores the initial velocity.

DOUBLE m_initialVelocity;  

Stores a pointer to a custom interpolator.

CCustomInterpolator* m_pInterpolator;  

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

void SetInitialValue(DOUBLE initialValue);

Parameters

initialValue

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

void SetInitialVelocity(DOUBLE initialVelocity);

Parameters

initialVelocity

Classes

Show: