Пример #1
0
        public override void Evaluate(float time)
        {
            var kfs = Keyframes.ToList();
            var kf  = kfs.FindLast(k => k.Time.Value <= time);
            var kf1 = kfs.Find(k => k.Time.Value > time);

            if (kf == null && kf1 == null)
            {
                CurrentValue = 0;
            }
            else if (kf == null)
            {
                CurrentValue = kf1.Value.Value;
            }
            else if (kf1 == null)
            {
                CurrentValue = kf.Value.Value;
            }
            else
            {
                var curve = Curves.FirstOrDefault(c => (c.Start == kf) && (c.End == kf1));
                if (curve != null)
                {
                    CurrentValue = curve.GetValue(time);
                }
            }
        }