Export (0) Print
Expand All

Schedule a Storyboard

After a storyboard is created, it is scheduled by the animation manager.

Overview

By default, each storyboard starts immediately when it is scheduled. This means that when a storyboard starts to animate one or more variables, it may interrupt any other storyboards animating those same variables. However, an application may specify other behaviors by determining the relative priority between storyboards.

After a storyboard has been scheduled, it can no longer be altered. However, after a storyboard has been removed from the schedule, it can be scheduled for play again. Developers should exercise caution when re-using storyboards, as this should only be done where there is no chance that the same storyboard might need to be queued due to a user action when it is already playing or queued in the schedule.

Example Code

The following example code is taken from MainWindow.cpp in the Windows Animation samples Application-Driven Animation and Timer-Driven Animation. It uses the IUIAnimationStoryboard::Schedule method to schedule the storyboard. This method requires the current time as a parameter.


// Get the current time and schedule the storyboard for play

UI_ANIMATION_SECONDS secondsNow;
hr = m_pAnimationTimer->GetTime(
    &secondsNow
    );
if (SUCCEEDED(hr))
{
    hr = pStoryboard->Schedule(
        secondsNow
    );
}

Previous Step

Before starting this step, you should have completed this step: Create a Storyboard and Add Transitions.

Related topics

IUIAnimationStoryboard::Schedule
IUIAnimationTimer::GetTime
Storyboard Overview

 

 

Community Additions

ADD
Show:
© 2014 Microsoft