本文整理汇总了C++中CComPtr::AddTransition方法的典型用法代码示例。如果您正苦于以下问题:C++ CComPtr::AddTransition方法的具体用法?C++ CComPtr::AddTransition怎么用?C++ CComPtr::AddTransition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComPtr
的用法示例。
在下文中一共展示了CComPtr::AddTransition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reset
void Timer::Reset(double seconds)
{
m_duration = seconds;
DOUBLE currentVal;
m_pVariable->GetValue(¤tVal);
if(currentVal == seconds)
return;
// Instant transition to 'seconds'
CComPtr<IUIAnimationTransition> instant;
CORt(g_manager->get_IUIAnimationTransitionLibrary()->CreateInstantaneousTransition(seconds, &instant));
// Linear transition to zero
CComPtr<IUIAnimationTransition> linear;
if(seconds != 0.0)
{
CORt(g_manager->get_IUIAnimationTransitionLibrary()->CreateLinearTransition(seconds, 0.0, &linear));
}
// Build up storyboard
CComPtr<IUIAnimationStoryboard> sb;
CORt(g_manager->get_IUIAnimationManager()->CreateStoryboard(&sb));
sb->AddTransition(m_pVariable, instant);
if(linear)
sb->AddTransition(m_pVariable, linear);
UI_ANIMATION_SECONDS secondsNow;
CORt(g_manager->get_IUIAnimationTimer()->GetTime(&secondsNow));
CORt(sb->Schedule(secondsNow));
g_manager->Update();
}
示例2: AnimateSweepTo
void CAnimatedAlphaWindow::AnimateSweepTo( double newSweep_I )
{
// Create a storyboard
CComPtr<IUIAnimationStoryboard> storyboard;
ASSERT_SUCCEEDED(mAnimMgr->CreateStoryboard(&storyboard));
// Create transitions
CComPtr<IUIAnimationTransition> stopTransition;
ASSERT_SUCCEEDED(mTransLib->CreateSmoothStopTransition(0.25,
newSweep_I, &stopTransition));
// Add the stopTransition
ASSERT_SUCCEEDED(storyboard->AddTransition(mSweepVar, stopTransition));
// Schedule the storyboard to animate now
UI_ANIMATION_SECONDS timeNow;
ASSERT_SUCCEEDED(mAnimTimer->GetTime(&timeNow));
ASSERT_SUCCEEDED(storyboard->Schedule(timeNow));
}
示例3: OnLButtonUp
void CAnimatedAlphaWindow::OnLButtonUp( UINT nFlags, CPoint point )
{
// Create a storyboard
CComPtr<IUIAnimationStoryboard> storyboard;
ASSERT_SUCCEEDED(mAnimMgr->CreateStoryboard(&storyboard));
// Create transitions
CComPtr<IUIAnimationTransition> stopTransition;
//ATLTRACE("Animating to %.0f\n", mNextAlphaValue);
ASSERT_SUCCEEDED(mTransLib->CreateSmoothStopTransition(0.5,
mNextAlphaValue, &stopTransition));
mNextAlphaValue = (mNextAlphaValue == LARGE ? SMALL : LARGE);
// Add the stopTransition
ASSERT_SUCCEEDED(storyboard->AddTransition(mAlphaVar, stopTransition));
// Schedule the storyboard to animate now
UI_ANIMATION_SECONDS timeNow;
ASSERT_SUCCEEDED(mAnimTimer->GetTime(&timeNow));
ASSERT_SUCCEEDED(storyboard->Schedule(timeNow));
}
示例4: CreateSlideAnimation
//-------------------------------------------------------------------------------
// Use WAM to generate and propagate the appropriate animation curves to DirectComposition when
// keypress is detected
//-------------------------------------------------------------------------------
HRESULT CApplication::CreateSlideAnimation(DIRECTION dir, IDCompositionAnimation **slideAnimation)
{
HRESULT hr = (slideAnimation == nullptr) ? E_POINTER : S_OK;
float rightMargin = 27 * TILE_SPACING * -1; //where the tiles end. Note forward direction is represented by a negative value.
float leftMargin = 0; // where the tiles begin
if (SUCCEEDED(hr))
{
*slideAnimation = nullptr;
hr = ((_device == nullptr) || (_animationVariable == nullptr)) ? E_UNEXPECTED : S_OK;
}
//WAM propagates curves to DirectComposition using the IDCompositionAnimation object
CComPtr<IDCompositionAnimation> animation;
if (SUCCEEDED(hr))
{
hr = _device->CreateAnimation(&animation);
}
//Create a storyboard for the slide animation
CComPtr<IUIAnimationStoryboard2> storyboard;
if (SUCCEEDED(hr))
{
hr = _manager->CreateStoryboard(&storyboard);
}
// Synchronizing WAM and DirectComposition time such that when WAM Update is called,
// the value reflects the DirectComposition value at the given time.
DCOMPOSITION_FRAME_STATISTICS frameStatistics = { 0 };
if (SUCCEEDED(hr))
{
hr = _device->GetFrameStatistics(&frameStatistics);
}
UI_ANIMATION_SECONDS nextEstimatedFrameTime = 0.0;
if (SUCCEEDED(hr))
{
nextEstimatedFrameTime = static_cast<double>(frameStatistics.nextEstimatedFrameTime.QuadPart) / static_cast<double>(frameStatistics.timeFrequency.QuadPart);
}
//Upating the WAM time
if (SUCCEEDED(hr))
{
hr = _manager->Update(nextEstimatedFrameTime);
}
CComPtr<IUIAnimationTransition2> transition;
double curValue = 0; //current value of the animation variable
int velocity = 500; //arbitrary fix velocity for the slide animation
if (SUCCEEDED(hr))
{
hr = _animationVariable->GetValue(&curValue);
switch (dir)
{
case stopForward:
case stopBackward:
// Stopping the animation smoothly when key is let go
if (curValue != leftMargin && curValue != rightMargin)
hr = _transitionLibrary->CreateSmoothStopTransition(0.5, curValue + dir * 50, &transition);
break;
case forward:
// slide the tiles forward using a linear curve upon left button press
hr = _transitionLibrary->CreateLinearTransition(-1 * (rightMargin - curValue)/velocity, rightMargin, &transition);
break;
case backward:
// slide the tiles backward using a linear cruve upon right button press
hr = _transitionLibrary->CreateLinearTransition(-1 * curValue/velocity, leftMargin, &transition);
break;
}
}
//Add above transition to storyboard
if (SUCCEEDED(hr))
{
hr = storyboard->AddTransition(_animationVariable, transition);
}
//schedule the storyboard for play at the next estimate vblank
if (SUCCEEDED(hr))
{
hr = storyboard->Schedule(nextEstimatedFrameTime);
}
//Giving WAM varialbe the IDCompositionAnimation object to recieve the animation curves
if (SUCCEEDED(hr))
{
hr = _animationVariable->GetCurve(animation);
}
//.........这里部分代码省略.........