public void UpdateCondition()
 {
   bool condition = GUIInfoManager.GetBool(_condition, 0);
   if (condition && !_lastCondition)
   {
     ApplyAnimation();
     _queuedProcess = AnimationProcess.Normal;
   }
   else if (!condition && _lastCondition)
   {
     if (_isReversible)
     {
       ApplyAnimation();
       _queuedProcess = AnimationProcess.Reverse;
     }
     else
     {
       ResetAnimation();
     }
   }
   _lastCondition = condition;
 }
 private void QueueAnimation(AnimationProcess process)
 {
   _queuedProcess = process;
 }
 public void ResetAnimation()
 {
   _currentProcess = AnimationProcess.None;
   _queuedProcess = AnimationProcess.None;
   _currentState = AnimationState.None;
 }
 public void ApplyAnimation()
 {
   _queuedProcess = AnimationProcess.None;
   if (_repeatAnim == AnimationRepeat.Pulse)
   {
     // pulsed anims auto-reverse
     _amount = 1.0f;
     _currentProcess = AnimationProcess.Reverse;
     _currentState = AnimationState.InProcess;
   }
   else if (_repeatAnim == AnimationRepeat.Loop)
   {
     // looped anims start over
     _amount = 0.0f;
     _currentProcess = AnimationProcess.Normal;
     _currentState = AnimationState.InProcess;
   }
   else
   {
     _currentProcess = AnimationProcess.None;
     _currentState = AnimationState.None;
   }
   Calculate();
 }
    public void Animate(uint time, bool startAnim)
    {
      if (_type == AnimationType.Conditional)
      {
        UpdateCondition();
      }

      // First start any queued animations
      if (_queuedProcess == AnimationProcess.Normal)
      {
        if (_currentProcess == AnimationProcess.Reverse)
        {
          _start = (uint)(time - (int)(_length * _amount)); // reverse direction of animation
        }
        else
        {
          _start = time;
        }
        _currentProcess = AnimationProcess.Normal;
      }
      else if (_queuedProcess == AnimationProcess.Reverse)
      {
        if (_currentProcess == AnimationProcess.Normal)
        {
          _start = (uint)(time - (int)(_length * (1 - _amount))); // turn around direction of animation
        }
        else if (_currentProcess == AnimationProcess.None)
        {
          _start = time;
        }
        _currentProcess = AnimationProcess.Reverse;
      }
      // reset the queued state once we've rendered to ensure allocation has occured
      if (startAnim || _queuedProcess == AnimationProcess.Reverse)
        // || (_currentState == ANI_STATE_DELAYED && _type > 0))
      {
        _queuedProcess = AnimationProcess.None;
      }


      // Update our animation process
      if (_currentProcess == AnimationProcess.Normal)
      {
        if (time - _start < _delay)
        {
          _amount = 0.0f;
          _currentState = AnimationState.Delayed;
        }
        else if (time - _start < _length + _delay)
        {
          _amount = (float)(time - _start - _delay) / _length;
          _currentState = AnimationState.InProcess;
        }
        else
        {
          _amount = 1.0f;
          if (_repeatAnim == AnimationRepeat.Pulse && _lastCondition)
          {
            // pulsed anims auto-reverse
            _currentProcess = AnimationProcess.Reverse;
            _start = time;
          }
          else if (_repeatAnim == AnimationRepeat.Loop && _lastCondition)
          {
            // looped anims start over
            _amount = 0.0f;
            _start = time;
          }
          else
          {
            _currentState = AnimationState.StateApplied;
          }
        }
      }
      else if (_currentProcess == AnimationProcess.Reverse)
      {
        if (time - _start < _length)
        {
          _amount = 1.0f - (float)(time - _start) / _length;
          _currentState = AnimationState.InProcess;
        }
        else
        {
          _amount = 0.0f;
          if (_repeatAnim == AnimationRepeat.Pulse && _lastCondition)
          {
            // pulsed anims auto-reverse
            _currentProcess = AnimationProcess.Normal;
            _start = time;
          }
          else
          {
            _currentState = AnimationState.StateApplied;
          }
        }
      }
    }
    public void RenderAnimation(ref TransformMatrix matrix)
    {
      // If we have finished an animation, reset the animation state
      // We do this here (rather than in Animate()) as we need the
      // currentProcess information in the UpdateStates() function of the
      // window and control classes.

      // Now do the real animation
      if (_currentProcess != AnimationProcess.None)
      {
        Calculate();
      }
      if (_currentState == AnimationState.StateApplied)
      {
        _currentProcess = AnimationProcess.None;
        _queuedProcess = AnimationProcess.None;
      }
      if (_currentState != AnimationState.None)
      {
        matrix.multiplyAssign(_matrix);
      }
    }
 public void Reset()
 {
   _tweener = null;
   _type = AnimationType.None;
   _effect = EffectType.None;
   _currentState = AnimationState.None;
   _currentProcess = _queuedProcess = AnimationProcess.None;
   _amount = 0;
   _delay = _start = _length = 0;
   _startX = _startY = _endX = _endY = 0;
   _centerX = _centerY = 0;
   _startAlpha = 0;
   _endAlpha = 100;
   //_acceleration = 0;
   _condition = 0;
   _isReversible = true;
   _lastCondition = false;
   _repeatAnim = AnimationRepeat.None;
   _clockHandle = ClockHandleType.None;
   _savedMinute = -1;
   _savedHour = -1;
 }
Esempio n. 8
0
 private void UpdateStates(AnimationType type, AnimationProcess currentProcess, AnimationState currentState) {}
Esempio n. 9
0
    private void UpdateStates(AnimationType type, AnimationProcess currentProcess, AnimationState currentState)
    {
      if (GUIGraphicsContext.Animations == false)
      {
        return;
      }
      bool visible = IsVisible;
      // Make sure control is hidden or visible at the appropriate times
      // while processing a visible or hidden animation it needs to be visible,
      // but when finished a hidden operation it needs to be hidden
      if (type == AnimationType.Visible)
      {
        if (currentProcess == AnimationProcess.Reverse)
        {
          if (currentState == AnimationState.StateApplied)
          {
            IsVisible = false;
          }
        }
        else if (currentProcess == AnimationProcess.Normal)
        {
          if (currentState == AnimationState.Delayed)
          {
            IsVisible = false;
          }
          else
          {
            IsVisible = _visibleFromSkinCondition;
          }
        }
      }
      else if (type == AnimationType.Hidden)
      {
        if (currentProcess == AnimationProcess.Normal) // a hide animation
        {
          if (currentState == AnimationState.StateApplied)
          {
            IsVisible = false; // finished
          }
          else
          {
            IsVisible = true; // have to be visible until we are finished
          }
        }
        else if (currentProcess == AnimationProcess.Reverse) // a visible animation
        {
          // no delay involved here - just make sure it's visible
          IsVisible = _visibleFromSkinCondition;
        }
      }
      else if (type == AnimationType.WindowOpen)
      {
/*
        if (currentProcess == AnimationProcess.Normal)
        {
          if (currentState == AnimationState.Delayed)
            IsVisible = false; // delayed
          else
            IsVisible = _visibleFromSkinCondition;
        }*/
      }
      else if (type == AnimationType.Focus)
      {
        // call the focus function if we have finished a focus animation
        // (buttons can "click" on focus)
        if (currentProcess == AnimationProcess.Normal && currentState == AnimationState.StateApplied)
        {
          OnFocus();
        }
      }
      //  if (visible != m_visible)
      //    CLog::DebugLog("UpdateControlState of control id %i - now %s (type=%d, process=%d, state=%d)", m_dwControlID, m_visible ? "visible" : "hidden", type, currentProcess, currentState);
    }
Esempio n. 10
0
        public void Animate(uint time, bool startAnim)
        {
            if (_type == AnimationType.Conditional)
            {
                UpdateCondition();
            }

            // First start any queued animations
            if (_queuedProcess == AnimationProcess.Normal)
            {
                if (_currentProcess == AnimationProcess.Reverse)
                {
                    _start = (uint)(time - (int)(_length * _amount)); // reverse direction of animation
                }
                else
                {
                    _start = time;
                }
                _currentProcess = AnimationProcess.Normal;
            }
            else if (_queuedProcess == AnimationProcess.Reverse)
            {
                if (_currentProcess == AnimationProcess.Normal)
                {
                    _start = (uint)(time - (int)(_length * (1 - _amount))); // turn around direction of animation
                }
                else if (_currentProcess == AnimationProcess.None)
                {
                    _start = time;
                }
                _currentProcess = AnimationProcess.Reverse;
            }
            // reset the queued state once we've rendered to ensure allocation has occured
            if (startAnim || _queuedProcess == AnimationProcess.Reverse)
            // || (_currentState == ANI_STATE_DELAYED && _type > 0))
            {
                _queuedProcess = AnimationProcess.None;
            }


            // Update our animation process
            if (_currentProcess == AnimationProcess.Normal)
            {
                if (time - _start < _delay)
                {
                    _amount       = 0.0f;
                    _currentState = AnimationState.Delayed;
                }
                else if (time - _start < _length + _delay)
                {
                    _amount       = (float)(time - _start - _delay) / _length;
                    _currentState = AnimationState.InProcess;
                }
                else
                {
                    _amount = 1.0f;
                    if (_repeatAnim == AnimationRepeat.Pulse && _lastCondition)
                    {
                        // pulsed anims auto-reverse
                        _currentProcess = AnimationProcess.Reverse;
                        _start          = time;
                    }
                    else if (_repeatAnim == AnimationRepeat.Loop && _lastCondition)
                    {
                        // looped anims start over
                        _amount = 0.0f;
                        _start  = time;
                    }
                    else
                    {
                        _currentState = AnimationState.StateApplied;
                    }
                }
            }
            else if (_currentProcess == AnimationProcess.Reverse)
            {
                if (time - _start < _length)
                {
                    _amount       = 1.0f - (float)(time - _start) / _length;
                    _currentState = AnimationState.InProcess;
                }
                else
                {
                    _amount = 0.0f;
                    if (_repeatAnim == AnimationRepeat.Pulse && _lastCondition)
                    {
                        // pulsed anims auto-reverse
                        _currentProcess = AnimationProcess.Normal;
                        _start          = time;
                    }
                    else
                    {
                        _currentState = AnimationState.StateApplied;
                    }
                }
            }
        }
Esempio n. 11
0
 public void ResetAnimation()
 {
     _currentProcess = AnimationProcess.None;
     _queuedProcess  = AnimationProcess.None;
     _currentState   = AnimationState.None;
 }