CBaseTransition 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 CBaseTransition Class.
Represents a basic transition.
class CBaseTransition : public CObject;
Public Enumerations
| Name | Description |
|---|---|
| CBaseTransition::TRANSITION_TYPE Enumeration | Defines the transition types currently supported by the MFC implementation of Windows Animation API. |
Public Constructors
| Name | Description |
|---|---|
| CBaseTransition::CBaseTransition | Constructs a base transtion object. |
| CBaseTransition::~CBaseTransition | The destructor. Called when a transition object is being destroyed. |
Public Methods
| Name | Description |
|---|---|
| CBaseTransition::AddToStoryboard | Adds a transition to a storyboard. |
| CBaseTransition::AddToStoryboardAtKeyframes | Adds a transition to a storyboard. |
| CBaseTransition::Clear | Releases encapsulated IUIAnimationTransition COM object. |
| CBaseTransition::Create | Creates a COM transition. |
| CBaseTransition::GetEndKeyframe | Returns start keyframe. |
| CBaseTransition::GetRelatedVariable | Returns a pointer to related variable. |
| CBaseTransition::GetStartKeyframe | Returns start keyframe. |
| CBaseTransition::GetTransition | Overloaded. Returns a pointer to underlying COM transition object. |
| CBaseTransition::GetType | Returns transition type. |
| CBaseTransition::IsAdded | Tells whether a transition has been added to a storyboard. |
| CBaseTransition::SetKeyframes | Sets keyframes for a transition. |
| CBaseTransition::SetRelatedVariable | Establishes a relationship between animation variable and transition. |
Protected Data Members
| Name | Description |
|---|---|
| CBaseTransition::m_bAdded | Specifies whether a transition has been added to a storyboard. |
| CBaseTransition::m_pEndKeyframe | Stores a pointer to the keyframe that specifies the end of the transition. |
| CBaseTransition::m_pRelatedVariable | A pointer to an animation variable, which is animated with the transition stored in m_transition. |
| CBaseTransition::m_pStartKeyframe | Stores a pointer to the keyframe that specifies the beginning of the transition. |
| CBaseTransition::m_transition | Stores a pointer to IUIAnimationTransition. NULL if a COM transition object has not been created. |
| CBaseTransition::m_type | Stores the transition type. |
This class encapsulates IUIAnimationTransition interface and serves as a base class for all transitions.
Header: afxanimationcontroller.h
The destructor. Called when a transition object is being destroyed.
virtual ~CBaseTransition();
Adds a transition to a storyboard.
BOOL AddToStoryboard(IUIAnimationStoryboard* pStoryboard);
Parameters
pStoryboard
A pointer to storyboard, which will animate the related variable.
Return Value
TRUE, if transition was successfully added to a storyboard.
Remarks
Applies the transition to the related variable in the storyboard. If this is the first transition applied to this variable in this storyboard, the transition begins at the start of the storyboard. Otherwise, the transition is appended to the transition added most recently to the variable.
Adds a transition to a storyboard.
BOOL AddToStoryboardAtKeyframes(IUIAnimationStoryboard* pStoryboard);
Parameters
pStoryboard
A pointer to storyboard, which will animate the related variable.
Return Value
TRUE, if transition was successfully added to a storyboard.
Remarks
Applies the transition to the related variable in the storyboard. If the start keyframe was specified, the transition begins at that keyframe. If the end keyframe was specified, the transition begins at the start keyframe and and stops at the end keyframe. If the transition was created with a duration parameter specified, that duration is overwritten with the duration of time between the start and end keyframes. If no keyframe was specified, the transition is appended to the transition added most recently to the variable.
Constructs a base transtion object.
CBaseTransition();
Releases encapsulated IUIAnimationTransition COM object.
void Clear();
Remarks
This method should be called from a derived class's Create method in order to prevent IUITransition interface leak.
Creates a COM transition.
virtual BOOL Create(
IUIAnimationTransitionLibrary* pLibrary,
IUIAnimationTransitionFactory* pFactory) = 0;
Parameters
pLibrary
A pointer to transition library, which creates standard transitions. It can be NULL for custom transitions.
pFactory
A pointer to transition factory, which creates custom transitions. It can be NULL for standard transitions.
Return Value
TRUE if a transition COM object was created successfully; otherwise FALSE.
Remarks
This is a pure virtual function that must be overridden in a derived class. It's called by the framework to instantiate the underlying COM transition object.
Returns start keyframe.
CBaseKeyFrame* GetEndKeyframe();
Return Value
A valid pointer to a keyframe, or NULL if a transition should not be inserted between keyframes.
Remarks
This method can be used to access a keyframe object that was previously set by SetKeyframes. It's called by top level code when transitions are being added to storyboard.
Returns a pointer to related variable.
CAnimationVariable* GetRelatedVariable();
Return Value
A valid pointer to animation variable, or NULL if an animation variable has not been set by SetRelatedVariable.
Remarks
This is an accessor to related animation variable.
Returns start keyframe.
CBaseKeyFrame* GetStartKeyframe();
Return Value
A valid pointer to a keyframe, or NULL if a transition should not start after a keyframe.
Remarks
This method can be used to access a keyframe object that was previously set by SetKeyframes. It's called by top level code when transitions are being added to storyboard.
Returns a pointer to underlying COM transition object.
IUIAnimationTransition* GetTransition(
IUIAnimationTransitionLibrary* pLibrary,
IUIAnimationTransitionFactory* pFactory);
IUIAnimationTransition* GetTransition();
Parameters
pLibrary
A pointer to transition library, which creates standard transitions. It can be NULL for custom transitions.
pFactory
A pointer to transition factory, which creates custom transitions. It can be NULL for standard transitions.
Return Value
A valid pointer to IUIAnimationTransition or NULL if underlying transition can't be created.
Remarks
This method returns a pointer to underlying COM transition object and creates it if necessary.
Returns transition type.
TRANSITION_TYPE GetType() const;
Return Value
One of TRANSITION_TYPE enumerated values.
Remarks
This method can be used to identify a transition object by its type. The type is set in a constructor in a derived class.
Tells whether a transition has been added to a storyboard.
BOOL IsAdded();
Return Value
Returns TRUE if a transition has been added to a storyboard, otherwise FALSE.
Remarks
This flag is set internally when the top level code adds transitions to storyboard.
Specifies whether a transition has been added to a storyboard.
BOOL m_bAdded;
Stores a pointer to the keyframe that specifies the end of the transition.
CBaseKeyFrame* m_pEndKeyframe;
A pointer to an animation variable, which is animated with the transition stored in m_transition.
CAnimationVariable* m_pRelatedVariable;
Stores a pointer to the keyframe that specifies the beginning of the transition.
CBaseKeyFrame* m_pStartKeyframe;
Stores a pointer to IUIAnimationTransition. NULL if a COM transition object has not been created.
ATL::CComPtr<IUIAnimationTransition> m_transition;
Stores the transition type.
TRANSITION_TYPE m_type;
Sets keyframes for a transition.
void SetKeyframes(
CBaseKeyFrame* pStart = NULL,
CBaseKeyFrame* pEnd = NULL);
Parameters
pStart
A keyframe that specifies the beginning of the transition.
pEnd
A keyframe that specifies the end of the transition.
Remarks
This method tells the transition to start after specified keyframe and, optionally, if pEnd is not NULL, end before the specified keyframe. If the transition was created with a duration parameter specified, that duration is overwritten with the duration of time between the start and end keyframes.
Establishes a relationship between animation variable and transition.
void SetRelatedVariable(CAnimationVariable* pVariable);
Parameters
pVariable
A pointer to related animation variable.
Remarks
Establishes a relationship between animation variable and transition. A transition can be applied only to one variable.
Defines the transition types currently supported by the MFC implementation of Windows Animation API.
enum TRANSITION_TYPE;
Remarks
A transition type is set in the constructor of specific transition. For example, CSinusoidalTransitionFromRange sets its type to SINUSOIDAL_FROM_RANGE.