Esempio n. 1
0
        public static void Remove(this IAnimationManager animationManager, int tickerId)
        {
            var animation = s_tweeners[tickerId];

            s_tweeners.Remove(tickerId);
            animationManager.Remove(animation);
        }
Esempio n. 2
0
 public void Pause()
 {
     if (_timer != 0)
     {
         animationManager.Remove(_timer);
         _timer = 0;
     }
 }
Esempio n. 3
0
        static void AnimateKineticInternal(IAnimatable self, IAnimationManager animationManager, string name, Func <double, double, bool> callback, double velocity, double drag, Action finished = null)
        {
            var key = new AnimatableKey(self, name);

            AbortKinetic(key);

            double sign = velocity / Math.Abs(velocity);

            velocity = Math.Abs(velocity);
            int tick = 0;

            tick = animationManager.Insert(step =>
            {
                long ms = step;

                velocity -= drag * ms;
                velocity  = Math.Max(0, velocity);

                var result = false;
                if (velocity > 0)
                {
                    result = callback(sign * velocity * ms, velocity);
                }

                if (!result)
                {
                    finished?.Invoke();
                    s_kinetics.Remove(key);
                    animationManager.Remove(tick);
                }
                return(result);
            });
            s_kinetics[key] = tick;
            if (!animationManager.Ticker.IsRunning)
            {
                animationManager.Ticker.Start();
            }
        }
Esempio n. 4
0
 public void Pause()
 {
     paused = true;
     animationManger?.Remove(this);
 }