本文整理汇总了C++中KeyframeEffectReadOnly::SetKeyframes方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyframeEffectReadOnly::SetKeyframes方法的具体用法?C++ KeyframeEffectReadOnly::SetKeyframes怎么用?C++ KeyframeEffectReadOnly::SetKeyframes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyframeEffectReadOnly
的用法示例。
在下文中一共展示了KeyframeEffectReadOnly::SetKeyframes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
static void
UpdateOldAnimationPropertiesWithNew(
CSSAnimation& aOld,
TimingParams& aNewTiming,
nsTArray<Keyframe>& aNewKeyframes,
bool aNewIsStylePaused,
nsStyleContext* aStyleContext)
{
bool animationChanged = false;
// Update the old from the new so we can keep the original object
// identity (and any expando properties attached to it).
if (aOld.GetEffect()) {
AnimationEffectReadOnly* oldEffect = aOld.GetEffect();
animationChanged = oldEffect->SpecifiedTiming() != aNewTiming;
oldEffect->SetSpecifiedTiming(aNewTiming);
KeyframeEffectReadOnly* oldKeyframeEffect = oldEffect->AsKeyframeEffect();
if (oldKeyframeEffect) {
oldKeyframeEffect->SetKeyframes(Move(aNewKeyframes), aStyleContext);
}
}
// Handle changes in play state. If the animation is idle, however,
// changes to animation-play-state should *not* restart it.
if (aOld.PlayState() != AnimationPlayState::Idle) {
// CSSAnimation takes care of override behavior so that,
// for example, if the author has called pause(), that will
// override the animation-play-state.
// (We should check aNew->IsStylePaused() but that requires
// downcasting to CSSAnimation and we happen to know that
// aNew will only ever be paused by calling PauseFromStyle
// making IsPausedOrPausing synonymous in this case.)
if (!aOld.IsStylePaused() && aNewIsStylePaused) {
aOld.PauseFromStyle();
animationChanged = true;
} else if (aOld.IsStylePaused() && !aNewIsStylePaused) {
aOld.PlayFromStyle();
animationChanged = true;
}
}
// Updating the effect timing above might already have caused the
// animation to become irrelevant so only add a changed record if
// the animation is still relevant.
if (animationChanged && aOld.IsRelevant()) {
nsNodeUtils::AnimationChanged(&aOld);
}
}