本文整理汇总了C++中KeyframeAnimation类的典型用法代码示例。如果您正苦于以下问题:C++ KeyframeAnimation类的具体用法?C++ KeyframeAnimation怎么用?C++ KeyframeAnimation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KeyframeAnimation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: animations
void CompositeAnimationPrivate::styleAvailable()
{
if (m_numStyleAvailableWaiters == 0)
return;
// We have to go through animations in the order in which they appear in
// the style, because order matters for additivity.
Vector<RefPtr<KeyframeAnimation> > animations(m_keyframeAnimations.size());
copyValuesToVector(m_keyframeAnimations, animations);
if (animations.size() > 1)
std::stable_sort(animations.begin(), animations.end(), compareAnimationIndices);
for (size_t i = 0; i < animations.size(); ++i) {
KeyframeAnimation* anim = animations[i].get();
if (anim && anim->waitingForStyleAvailable())
anim->updateStateMachine(AnimationBase::AnimationStateInputStyleAvailable, -1);
}
CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
ImplicitAnimation* anim = it->second.get();
if (anim && anim->waitingForStyleAvailable())
anim->updateStateMachine(AnimationBase::AnimationStateInputStyleAvailable, -1);
}
}
示例2: timeToNextService
double CompositeAnimation::timeToNextService() const
{
// Returns the time at which next service is required. -1 means no service is required. 0 means
// service is required now, and > 0 means service is required that many seconds in the future.
double minT = -1;
if (!m_transitions.isEmpty()) {
CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
ImplicitAnimation* transition = it->second.get();
double t = transition ? transition->timeToNextService() : -1;
if (t < minT || minT == -1)
minT = t;
if (minT == 0)
return 0;
}
}
if (!m_keyframeAnimations.isEmpty()) {
m_keyframeAnimations.checkConsistency();
AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
KeyframeAnimation* animation = it->second.get();
double t = animation ? animation->timeToNextService() : -1;
if (t < minT || minT == -1)
minT = t;
if (minT == 0)
return 0;
}
}
return minT;
}
示例3: numberOfActiveAnimations
unsigned CompositeAnimation::numberOfActiveAnimations() const
{
unsigned count = 0;
if (!m_keyframeAnimations.isEmpty()) {
m_keyframeAnimations.checkConsistency();
AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
KeyframeAnimation* anim = it->value.get();
if (anim->running())
++count;
}
}
if (!m_transitions.isEmpty()) {
CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
ImplicitAnimation* anim = it->value.get();
if (anim->running())
++count;
}
}
return count;
}
示例4: resumeAnimations
void CompositeAnimation::resumeAnimations()
{
if (!m_suspended)
return;
m_suspended = false;
if (!m_keyframeAnimations.isEmpty()) {
m_keyframeAnimations.checkConsistency();
AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
KeyframeAnimation* anim = it->value.get();
if (anim && anim->playStatePlaying())
anim->updatePlayState(AnimPlayStatePlaying);
}
}
if (!m_transitions.isEmpty()) {
CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
ImplicitAnimation* anim = it->value.get();
if (anim && anim->hasStyle())
anim->updatePlayState(AnimPlayStatePlaying);
}
}
}
示例5: getKeyframes
/*!
@brief returns the two keyframes for a given time.
@param keyframes - a map with all keyframes of type KeyframeAnimation
@param time - the time fraction between 0 and 1.
@param k0, reference to the first keyframe
@param k2, reference to the second keyframe
@return the number of keyframes. 1 if the time is equal to a keyframe, otherwise 2.
*/
int getKeyframes( KeyframeAnimation& keyframes, const double time, Keyframe& k0, Keyframe& k1)
{
int num_keyframes = 0;
// get a keyframe iterator
KeyframeAnimation::iterator k_itr = keyframes.lower_bound(time);
Keyframe k0_temp, k1_temp;
// Obtain the first keyframe
k1 = (*k_itr).second; num_keyframes++;
// Check whether we are not at the beginning of this map
if(k_itr != keyframes.begin())
{
k_itr--; // decrement
k0 = (*k_itr).second; // obtain the second keyframe
num_keyframes++;
}
// write the first keyframe into k0 if we only have one
if(num_keyframes == 1)
{
k0 = k1;
}
return num_keyframes;
}
示例6: setAnimationStartTime
void CompositeAnimationPrivate::setAnimationStartTime(double t)
{
// Set start time on all animations waiting for it
AnimationNameMap::const_iterator end = m_keyframeAnimations.end();
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != end; ++it) {
KeyframeAnimation* anim = it->second.get();
if (anim && anim->waitingForStartTime())
anim->updateStateMachine(AnimationBase::AnimationStateInputStartTimeSet, t);
}
}
示例7: setAnimationStartTime
void CompositeAnimation::setAnimationStartTime(double t)
{
// set start time on all animations waiting for it
AnimationNameMap::const_iterator kfend = m_keyframeAnimations.end();
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) {
KeyframeAnimation* anim = it->second;
if (anim && anim->waitingForStartTime())
anim->updateStateMachine(AnimationBase::STATE_INPUT_START_TIME_SET, t);
}
}
示例8: KeyframeData
Animation * GameObject::FrameInterpolateAnimation(int32 startFrame, int32 endFrame, float32 time, int32 track)
{
KeyframeData * data = new KeyframeData();
data->AddKeyframe(startFrame, 0.0f);
data->AddKeyframe(endFrame, time);
KeyframeAnimation * animation = new KeyframeAnimation(this, &localDrawState.frame, data, time);
SafeRelease(data);
animation->Start(track);
return animation;
}
示例9: setAnimating
// "animating" means that something is running that requires the timer to keep firing
void CompositeAnimationPrivate::setAnimating(bool animating)
{
CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
ImplicitAnimation* transition = it->second.get();
transition->setAnimating(animating);
}
AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
KeyframeAnimation* anim = it->second.get();
anim->setAnimating(animating);
}
}
示例10: setAnimating
// "animating" means that something is running that requires the timer to keep firing
// (e.g. a transition)
void CompositeAnimation::setAnimating(bool inAnimating)
{
CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
ImplicitAnimation* transition = it->second;
transition->setAnimating(inAnimating);
}
AnimationNameMap::const_iterator kfend = m_keyframeAnimations.end();
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) {
KeyframeAnimation* anim = it->second;
anim->setAnimating(inAnimating);
}
}
示例11: isAnimatingProperty
bool CompositeAnimation::isAnimatingProperty(int property, bool isRunningNow) const
{
AnimationNameMap::const_iterator kfend = m_keyframeAnimations.end();
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) {
KeyframeAnimation* anim = it->second;
if (anim && anim->isAnimatingProperty(property, isRunningNow))
return true;
}
CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
ImplicitAnimation* anim = it->second;
if (anim && anim->isAnimatingProperty(property, isRunningNow))
return true;
}
return false;
}
示例12: setAnimating
// "animating" means that something is running that requires the timer to keep firing
void CompositeAnimation::setAnimating(bool animating)
{
if (!m_transitions.isEmpty()) {
CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
ImplicitAnimation* transition = it->second.get();
transition->setAnimating(animating);
}
}
if (!m_keyframeAnimations.isEmpty()) {
m_keyframeAnimations.checkConsistency();
AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
KeyframeAnimation* anim = it->second.get();
anim->setAnimating(animating);
}
}
}
示例13: clearRenderer
void CompositeAnimationPrivate::clearRenderer()
{
// Clear the renderers from all running animations, in case we are in the middle of
// an animation callback (see https://bugs.webkit.org/show_bug.cgi?id=22052)
CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
ImplicitAnimation* transition = it->second.get();
transition->clearRenderer();
}
AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
KeyframeAnimation* anim = it->second.get();
anim->clearRenderer();
}
}
示例14: animating
bool CompositeAnimation::animating()
{
CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
ImplicitAnimation* transition = it->second;
if (transition && transition->animating() && transition->running())
return true;
}
AnimationNameMap::const_iterator kfend = m_keyframeAnimations.end();
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) {
KeyframeAnimation* anim = it->second;
if (anim && !anim->paused() && anim->animating() && anim->active())
return true;
}
return false;
}
示例15: resumeAnimations
void CompositeAnimation::resumeAnimations()
{
if (!m_suspended)
return;
m_suspended = false;
AnimationNameMap::const_iterator kfend = m_keyframeAnimations.end();
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) {
KeyframeAnimation* anim = it->second;
if (anim && anim->playStatePlaying())
anim->updatePlayState(true);
}
CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
ImplicitAnimation* anim = it->second;
if (anim && anim->hasStyle())
anim->updatePlayState(true);
}
}