示例#1
0
 public TransitionColor(ITimingFunction f)
 {
     _transitionFloat = new TransitionFloat(f)
     {
         Start = 0, End = 1
     };
 }
示例#2
0
        public void AddKeyPoint(float x, float y, ITimingFunction f)
        {
            if (x < 0 || x > 1)
            {
                throw new ArgumentException("0f <= x <= 1f");
            }
            if (y < 0 || y > 1)
            {
                throw new ArgumentException("0f <= y <= 1f");
            }

            KeyPoints.Add(new Vector2(x, y), f);
            KeyPoints = KeyPoints.OrderBy(v => v.Key.X).ToDictionary(pair => pair.Key, pair => pair.Value);
        }
示例#3
0
        public float GetValue(float t)
        {
            for (int i = 0; i < KeyPoints.Count; i++)
            {
                if (t >= KeyPoints.ElementAt(i).Key.X)
                {
                    float           x        = KeyPoints.ElementAt(i).Key.X;
                    float           y        = KeyPoints.ElementAt(i).Key.Y;
                    ITimingFunction function = KeyPoints.ElementAt(i).Value;

                    float intervalX = (i + 1 < KeyPoints.Count) ? KeyPoints.ElementAt(i + 1).Key.X - x : 1f - x;
                    float intervalY = (i + 1 < KeyPoints.Count) ? KeyPoints.ElementAt(i + 1).Key.Y - y : 1f - y;

                    return((function.GetValue((t - x) / intervalX) * intervalY) + y);
                }
            }
            return(1f);
        }
示例#4
0
 public TransitionFloat(ITimingFunction f)
     : base(f)
 {
 }
示例#5
0
 public TransitionVector4(ITimingFunction f)
     : base(f)
 {
 }
示例#6
0
 protected TransitionVector(ITimingFunction f)
 {
     Function = f;
     _isInit  = false;
 }
示例#7
0
 public void ClearKeyPoints(ITimingFunction f)
 {
     KeyPoints.Clear();
     KeyPoints.Add(new Vector2(0, 0), f);
 }
示例#8
0
 public CustomFunction(ITimingFunction f)
 {
     KeyPoints = new Dictionary <Vector2, ITimingFunction> {
         { Vector2.Zero, f }
     };
 }