private void ResetBeginingValues()
 {
     try
     {
         foreach (GetterSetterData data in Props.Values)
         {
             if (!data.IsActive)
             {
                 continue;
             }
             try
             {
                 data.ValueStart = data.Getter(Target, data);
                 RegisterDependencyProperty(data.Name);
             }
             catch (Exception error)
             {
                 data.IsActive = false;
                 Debug.WriteLine(string.Format("{0} - [ERROR] - Failed to ResetBeginingValue. Setting Prop InActive. - {1} - \n{2}", this, GetterSetterData.Describe(data), error));
                 #if DEBUG
                 throw;
                 #endif
             }
         }
     }
     catch (Exception error)
     {
         Debug.WriteLine(string.Format("{0} - [ERROR] - ResetBeginingValues - {1}", this, error));
         #if DEBUG
         throw;
         #endif
     }
 }
        public void Tick()
        {
            if ((flags & IS_RUNNING) != IS_RUNNING ||   // Ease object is not running
                Props.Count <= 0)                       // Without properties to ease, there is no way to tell when to stop.
            {
                #if debug
                Debug.WriteLine(string.Format("{0} {1}/{2} - [ERROR] - Not Currently Running or missing props to ease -> stopping esae object now.", this, inx, EaseObjectCount));
                #endif

                Stop();
                return;
            }

            // Calculate ellapsed time
            _timeElapsed = ArtefactAnimator.ElapsedMilliseconds - TimeStarted;


            if ((flags & IS_DELAYED) == IS_DELAYED) // Check delay
            {
                if (_timeElapsed < Delay)           // wait
                {
                    #if debug
                    Debug.WriteLine(string.Format("{0} - [DEBUG] - Delayed{3} - {1}<{2}.", this, _timeElapsed, Delay, inx));
                    #endif

                    return;
                }

                // continue
                flags       -= IS_DELAYED;
                TimeStarted  = ArtefactAnimator.ElapsedMilliseconds - (_timeElapsed - Delay);
                _timeElapsed = 0;
            }

            // first time running - set begining values
            if ((flags & IS_FIRSTRUN) == IS_FIRSTRUN)
            {
                flags -= IS_FIRSTRUN;
                ResetBeginingValues();
                if (Begin != null)
                {
                    Begin(this, PercentEase);
                }
            }


            if (Time < _timeElapsed)
            {
                Finish();
                return;
            }

            // update
            PercentTime = (_timeElapsed) / Time;
            PercentEase = Ease == null ? PercentTime : Ease(PercentTime);
            ActiveCount = 0;

            foreach (GetterSetterData data in Props.Values)
            {
                if (!data.IsActive)
                {
                    continue;
                }
                ActiveCount++;
                try
                {
                    data.Setter(Target, data, PercentEase);
                }
                catch (Exception error)
                {
                    data.IsActive = false;
                    ActiveCount--;
                    Debug.WriteLine("[ERROR] - EaseObject failed to apply Setter in Update() - " + GetterSetterData.Describe(data) + "\n" + error);
                   #if DEBUG
                    throw;
                   #endif
                }
            }

            if (ActiveCount > 0)
            {
                if (Update != null)
                {
                    Update(this, PercentEase);
                }
            }
            else
            {
                Stop(); // Nothing happened
            }
        }