本文整理汇总了C++中KeyframeEffectReadOnly::SetTiming方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyframeEffectReadOnly::SetTiming方法的具体用法?C++ KeyframeEffectReadOnly::SetTiming怎么用?C++ KeyframeEffectReadOnly::SetTiming使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyframeEffectReadOnly
的用法示例。
在下文中一共展示了KeyframeEffectReadOnly::SetTiming方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mb
//.........这里部分代码省略.........
nsRefPtr<CSSAnimation> oldAnim;
size_t oldIdx = collection->mAnimations.Length();
while (oldIdx-- != 0) {
CSSAnimation* a = collection->mAnimations[oldIdx]->AsCSSAnimation();
MOZ_ASSERT(a, "All animations in the CSS Animation collection should"
" be CSSAnimation objects");
if (a->AnimationName() ==
newAnim->AsCSSAnimation()->AnimationName()) {
oldAnim = a;
break;
}
}
if (!oldAnim) {
// FIXME: Bug 1134163 - We shouldn't queue animationstart events
// until the animation is actually ready to run. However, we
// currently have some tests that assume that these events are
// dispatched within the same tick as the animation is added
// so we need to queue up any animationstart events from newly-created
// animations.
newAnim->AsCSSAnimation()->QueueEvents();
continue;
}
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 (oldAnim->GetEffect() && newAnim->GetEffect()) {
KeyframeEffectReadOnly* oldEffect = oldAnim->GetEffect();
KeyframeEffectReadOnly* newEffect = newAnim->GetEffect();
animationChanged =
oldEffect->Timing() != newEffect->Timing() ||
oldEffect->Properties() != newEffect->Properties();
oldEffect->SetTiming(newEffect->Timing(), *oldAnim);
oldEffect->Properties() = newEffect->Properties();
}
// Handle changes in play state. If the animation is idle, however,
// changes to animation-play-state should *not* restart it.
if (oldAnim->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 newAnim->IsStylePaused() but that requires
// downcasting to CSSAnimation and we happen to know that
// newAnim will only ever be paused by calling PauseFromStyle
// making IsPausedOrPausing synonymous in this case.)
if (!oldAnim->IsStylePaused() && newAnim->IsPausedOrPausing()) {
oldAnim->PauseFromStyle();
animationChanged = true;
} else if (oldAnim->IsStylePaused() &&
!newAnim->IsPausedOrPausing()) {
oldAnim->PlayFromStyle();
animationChanged = true;
}
}
oldAnim->CopyAnimationIndex(*newAnim->AsCSSAnimation());
// 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 && oldAnim->IsRelevant()) {
nsNodeUtils::AnimationChanged(oldAnim);
}