void CGUIControl::QueueAnimation(ANIMATION_TYPE animType) { MarkDirtyRegion(); if (!CheckAnimation(animType)) return; CAnimation *reverseAnim = GetAnimation((ANIMATION_TYPE)-animType, false); CAnimation *forwardAnim = GetAnimation(animType); // we first check whether the reverse animation is in progress (and reverse it) // then we check for the normal animation, and queue it if (reverseAnim && reverseAnim->IsReversible() && (reverseAnim->GetState() == ANIM_STATE_IN_PROCESS || reverseAnim->GetState() == ANIM_STATE_DELAYED)) { reverseAnim->QueueAnimation(ANIM_PROCESS_REVERSE); if (forwardAnim) forwardAnim->ResetAnimation(); } else if (forwardAnim) { forwardAnim->QueueAnimation(ANIM_PROCESS_NORMAL); if (reverseAnim) reverseAnim->ResetAnimation(); } else { // hidden and visible animations delay the change of state. If there is no animations // to perform, then we should just change the state straightaway if (reverseAnim) reverseAnim->ResetAnimation(); UpdateStates(animType, ANIM_PROCESS_NORMAL, ANIM_STATE_APPLIED); } }
void CGUIControl::QueueAnimation(ANIMATION_TYPE animType) { // rule out the animations we shouldn't perform if (!IsVisible() || !HasRendered()) { // hidden or never rendered - don't allow exit or entry animations for this control if (animType == ANIM_TYPE_WINDOW_CLOSE) { // could be animating a (delayed) window open anim, so reset it ResetAnimation(ANIM_TYPE_WINDOW_OPEN); return; } } if (!IsVisible()) { // hidden - only allow hidden anims if we're animating a visible anim if (animType == ANIM_TYPE_HIDDEN && !IsAnimating(ANIM_TYPE_VISIBLE)) { // update states to force it hidden UpdateStates(animType, ANIM_PROCESS_NORMAL, ANIM_STATE_APPLIED); return; } if (animType == ANIM_TYPE_WINDOW_OPEN) return; } CAnimation *reverseAnim = GetAnimation((ANIMATION_TYPE)-animType, false); CAnimation *forwardAnim = GetAnimation(animType); // we first check whether the reverse animation is in progress (and reverse it) // then we check for the normal animation, and queue it if (reverseAnim && reverseAnim->IsReversible() && (reverseAnim->GetState() == ANIM_STATE_IN_PROCESS || reverseAnim->GetState() == ANIM_STATE_DELAYED)) { reverseAnim->QueueAnimation(ANIM_PROCESS_REVERSE); if (forwardAnim) forwardAnim->ResetAnimation(); } else if (forwardAnim) { forwardAnim->QueueAnimation(ANIM_PROCESS_NORMAL); if (reverseAnim) reverseAnim->ResetAnimation(); } else { // hidden and visible animations delay the change of state. If there is no animations // to perform, then we should just change the state straightaway if (reverseAnim) reverseAnim->ResetAnimation(); UpdateStates(animType, ANIM_PROCESS_NORMAL, ANIM_STATE_APPLIED); } }