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