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

Implements an animation group, which combines an animation storyboard, animation objects, and transitions to define an animation.

class CAnimationGroup;  

Public Constructors

NameDescription
CAnimationGroup::CAnimationGroupConstructs an animation group.
CAnimationGroup::~CAnimationGroupThe destructor. Called when an animation group is being destroyed.

Public Methods

NameDescription
CAnimationGroup::AnimateAnimates a group.
CAnimationGroup::ApplyTransitionsApplies transitions to animation objects.
CAnimationGroup::FindAnimationObjectFinds an animation object that contains the specified animation variable.
CAnimationGroup::GetGroupIDReturns GroupID.
CAnimationGroup::RemoveKeyframesRemoves and optionally destroys all keyframes that belong to an animation group.
CAnimationGroup::RemoveTransitionsRemoves transitions from animation objects that belong to an animation group.
CAnimationGroup::ScheduleSchedules an animation at the specified time.
CAnimationGroup::SetAutodestroyTransitionsDirects all animation objects that belong to group automatically destroy transitions.

Protected Methods

NameDescription
CAnimationGroup::AddKeyframesA helper that adds keyframes to a storyboard.
CAnimationGroup::AddTransitionsA helper that adds transitions to a storyboard.
CAnimationGroup::CreateTransitionsA helper that creates COM transition objects.

Public Data Members

NameDescription
CAnimationGroup::m_bAutoclearTransitionsSpecifies how to clear transitions from animation objects that belong to group. If this member is TRUE, transitions are removed automatically when an animation has been scheduled. Otherwise you need to remove transitions manually.
CAnimationGroup::m_bAutodestroyAnimationObjectsSpecifies how to destroy animation objects. If this parameter is TRUE, animation objects will be destroyed automatically when the group is destroyed. Otherwise animation objects must be destroyed manually. The default value is FALSE. Set this value to TRUE only if all animation objects that belong to group are allocated dynamically with operator new.
CAnimationGroup::m_bAutodestroyKeyframesSpecifies how to destroy keyframes. If this value is TRUE, all keyframes are removed and destroyed; otherwise they are removed from the list only. The default value is TRUE.
CAnimationGroup::m_lstAnimationObjectsContains a list of animation objects.
CAnimationGroup::m_lstKeyFramesContains a list of keyframes.
CAnimationGroup::m_pStoryboardPoints to animation storyboard. This pointer is valid only after call on Animate.

Protected Data Members

NameDescription
CAnimationGroup::m_nGroupIDA unique identifier of animation group.
CAnimationGroup::m_pParentControllerA pointer to animation controller this group belongs to.

Animation groups are created automatically by animation controller (CAnimationController) when you add animation objects using CAnimationController::AddAnimationObject. An animation group is identified by GroupID, which is usually taken as a parameter to manipulate animation groups. The GroupID is taken from the first animation object being added to a new animation group. An encapsulated animation storyboard is created after you call CAnimationController::AnimateGroup and can be accessed via public member m_pStoryboard.

CAnimationGroup

Header: afxanimationcontroller.h

The destructor. Called when an animation group is being destroyed.

~CAnimationGroup();

A helper that adds keyframes to a storyboard.

void AddKeyframes(IUIAnimationStoryboard* pStoryboard, BOOL bAddDeep);

Parameters

pStoryboard
A pointer to a storyboard COM object.

bAddDeep
Specifies whether this method should add to the storyboard keyframes that depend on other keyframes.

A helper that adds transitions to a storyboard.

void AddTransitions(
    IUIAnimationStoryboard* pStoryboard,  
    BOOL bDependOnKeyframes);

Parameters

pStoryboard
A pointer to a storyboard COM object.

bDependOnKeyframes

Animates a group.

BOOL Animate(
    IUIAnimationManager* pManager,  
    IUIAnimationTimer* pTimer,  
    BOOL bScheduleNow);

Parameters

pManager
pTimer
bScheduleNow

Return Value

TRUE if the method succeeds; otherwise FALSE.

Remarks

This method creates an internal storyboard, creates and applies transitions and schedules an animation if bScheduleNow is TRUE. If bScheduleNow is FALSE, you need to call Schedule to start animation at the specified time.

Applies transitions to animation objects.

void ApplyTransitions();

Remarks

This method ASSERTS in debug mode if storyboard has not been created. It creates all transitions first, then adds "static" keyframes (keyframes that depend on offsets), adds transitions that do not depend on keyframes, adds keyframes depending on transitions and other keyframes, and at last adds transitions that depend on keyframes.

Constructs an animation group.

CAnimationGroup(CAnimationController* pParentController, UINT32 nGroupID);

Parameters

pParentController
A pointer to animation controller that creates a group.

nGroupID
Specifies GroupID.

A helper that creates COM transition objects.

BOOL CreateTransitions();

Return Value

TRUE is the method succeeds, otherwise FALSE.

Finds an animation object that contains the specified animation variable.

CAnimationBaseObject* FindAnimationObject(IUIAnimationVariable* pVariable);

Parameters

pVariable
A pointer to animation variable.

Return Value

A pointer to animation object, or NULL if animation object is not found.

Returns GroupID.

UINT32 GetGroupID() const;  

Return Value

A group identifier.

Specifies how to clear transitions from animation objects that belong to group. If this member is TRUE, transitions are removed automatically when an animation has been scheduled. Otherwise you need to remove transitions manually.

BOOL m_bAutoclearTransitions;  

Specifies how to destroy animation objects. If this parameter is TRUE, animation objects will be destroyed automatically when the group is destroyed. Otherwise animation objects must be destroyed manually. The default value is FALSE. Set this value to TRUE only if all animation objects that belong to group are allocated dynamically with operator new.

BOOL m_bAutodestroyAnimationObjects;  

Specifies how to destroy keyframes. If this value is TRUE, all keyframes are removed and destroyed; otherwise they are removed from the list only. The default value is TRUE.

BOOL m_bAutodestroyKeyframes;  

Contains a list of animation objects.

CObList m_lstAnimationObjects;  

Contains a list of keyframes.

CObList m_lstKeyFrames;  

A unique identifier of animation group.

UINT32 m_nGroupID;  

A pointer to animation controller this group belongs to.

CAnimationController* m_pParentController;  

Points to animation storyboard. This pointer is valid only after call on Animate.

ATL::CComPtr<IUIAnimationStoryboard> m_pStoryboard;  

Removes and optionally destroys all keyframes that belong to an animation group.

void RemoveKeyframes();

Remarks

If m_bAutodestroyKeyframes member is TRUE then keyframes are removed and destroyed, otherwise keyframes are just removed from the internal list of keyframes.

Removes transitions from animation objects that belong to an animation group.

void RemoveTransitions();

Remarks

If m_bAutoclearTransitions flag is set to TRUE, this method loops over all animation objects that belong to the group and calls CAnimationObject::ClearTransitions(FALSE).

Schedules an animation at the specified time.

BOOL Schedule(IUIAnimationTimer* pTimer, UI_ANIMATION_SECONDS time);

Parameters

pTimer
A pointer to animation timer.

time
Specifies time to schedule the animation.

Return Value

TRUE if the method succeeds; FALSE if the method fails or if Animate has not been called with bScheduleNow set to FALSE.

Remarks

Call this function to schedule an animation at the specified time. You must call Animate with bScheduleNow set to FALSE first.

Directs all animation objects that belong to group automatically destroy transitions.

void SetAutodestroyTransitions(BOOL bAutoDestroy = TRUE);

Parameters

bAutoDestroy
Specifies how to destroy transitions.

Remarks

Set this value to FALSE only if you allocate transitions on the stack. The default value is TRUE, therefore it's highly recommended to allocate transition objects using operator new.

Classes

Show: