예제 #1
0
        public void Animate(
            string animationName,
            Bind pctl,
            IBaseModel model,
            string propertyName,
            object endValue,
            float start,
            float length)
        {
            if (model.GetPropertyByName(propertyName).GetType().Equals(typeof(int)))
            {
                KineticPath path = new KineticPath(
                    (int)pctl.Get(),
                    (int)endValue,
                    length);

                PropertyAnimation anim = new PropertyAnimation(animationName, path.ComputeFrame, pctl);
                anim.Start = GetCurrentGameTime() + start;
                anim.End   = GetCurrentGameTime() + length + start;
                AddAnimation(animationName, anim);
            }
            else
            {
                throw new NotImplementedException("Only integers can be animated now!!!");
            }
        }
예제 #2
0
        public void Update(Double currentTime)
        {
            lastUpdateTime = currentTime;

            lock (animations)
            {
                foreach (KeyValuePair <string, PropertyAnimation> animation in animations)
                {
                    PropertyAnimation node = animation.Value;
                    node.Update(currentTime);
                }

                lock (animationsToAdd)
                {
                    foreach (KeyValuePair <string, PropertyAnimation> animation in animationsToAdd)
                    {
                        animations[animation.Key] = animation.Value;
                    }

                    animationsToAdd.Clear();
                }
            }

            lock (toDelete)
            {
                foreach (string key in toDelete)
                {
                    RemoveAnimation(key);
                    OnAnimationEnded(key);
                }
                toDelete.Clear();
            }
        }
예제 #3
0
 public void AddAnimation(string name, PropertyAnimation anim)
 {
     lock (animationsToAdd)
     {
         anim.RegisterListener(this);
         animationsToAdd[name] = anim;
     }
 }
예제 #4
0
 private void RemoveAnimation(string name)
 {
     lock (animations)
     {
         PropertyAnimation anim = animations[name];
         anim.Stop();
         anim.UnregisterListener(this);
         animations.Remove(name);
     }
 }
예제 #5
0
        public void AnimateColor(
            string animationName,
            Bind pctl,
            object endValue,
            float length)
        {
            ColorAnimationPath path = new ColorAnimationPath(
                (Color)pctl.Get(),
                (Color)endValue,
                length);

            PropertyAnimation anim = new PropertyAnimation(animationName, path.ComputeFrame, pctl);

            anim.Start = CoreAnimation.Instance.GetCurrentGameTime();
            anim.End   = CoreAnimation.Instance.GetCurrentGameTime() + length;
            CoreAnimation.Instance.AddAnimation(animationName, anim);
        }
예제 #6
0
        public void ToggleProperty(
            string animationName,
            Bind pctl,
            object startValue,
            object endValue,
            float start,
            float length,
            float period)
        {
            BlinkPath path = new BlinkPath(startValue, endValue, period, length);

            PropertyAnimation anim = new PropertyAnimation(animationName, path.ComputeFrame, pctl);

            anim.Start = GetCurrentGameTime() + start;
            anim.End   = GetCurrentGameTime() + length + start;
            AddAnimation(animationName, anim);
        }
예제 #7
0
        public void Animate(
            string animationName,
            Bind pctl,
            object startValue,
            object endValue,
            float start,
            float length)
        {
            KineticPath path = new KineticPath(
                (int)startValue,
                (int)endValue,
                length);

            PropertyAnimation anim = new PropertyAnimation(animationName, path.ComputeFrame, pctl);

            anim.Start = GetCurrentGameTime() + start;
            anim.End   = GetCurrentGameTime() + length + start;
            AddAnimation(animationName, anim);
        }