public AnimationChannel Initialize(AnimationChannel channel, int type)
        {
            switch (type)
            {
                case 0:
                    {
                        channel.curve1 = new Curve();
                        channel.curve1.Keys.Add(new CurveKey(10, 10) { Continuity = CurveContinuity.Step });
                        channel.curve1.Keys.Add(new CurveKey(210, 100));
                        channel.curve1.Keys.Add(new CurveKey(420, 10));
                        channel.curve1.ComputeTangents(CurveTangent.Smooth);
                    }
                    break;
                case 1:
                    {
                        channel.curve1 = new Curve();
                        channel.curve1.Keys.Add(new CurveKey(10, 10) { Continuity = CurveContinuity.Step });
                        channel.curve1.Keys.Add(new CurveKey(310, 100));
                        channel.curve1.Keys.Add(new CurveKey(520, 10));
                        channel.curve1.ComputeTangents(CurveTangent.Smooth);
                    }
                    break;
                case 2:
                    {
                        channel.curve1 = new Curve();
                        channel.curve1.Keys.Add(new CurveKey(10, 10) { Continuity = CurveContinuity.Step });
                        channel.curve1.Keys.Add(new CurveKey(810, 100));
                        channel.curve1.Keys.Add(new CurveKey(1420, 10));
                        channel.curve1.ComputeTangents(CurveTangent.Smooth);
                    }
                    break;
            }



            channel.curve2 = new Curve();
            for (int i = 0; i < channel.curve1.Keys.Count; i++)
                channel.curve2.Keys.Add(new CurveKey(channel.curve1.Keys[i].Position, channel.curve1.Keys[i].Position) { Continuity = channel.curve1.Keys[i].Continuity });
            channel.curve2.ComputeTangents(CurveTangent.Smooth);
            return channel;
        }
 public void NotifyCurveInvalidated(AnimationChannel Tweenable)
 {
     DataGrid Part_AnimationChannels = Template.FindName("Part_AnimationChannels", this) as DataGrid;
     ScrollViewer viewer = Part_AnimationChannels.Template.FindName("Part_ScrollViewer", Part_AnimationChannels) as ScrollViewer;
     AnimationCurvePreview splineEditor = viewer.Template.FindName("Part_Preview", viewer) as AnimationCurvePreview;
     splineEditor.InvalidateVisual();
     Tweenable.Value = Tweenable.curve1.Evaluate((float)AnimationCurrentTime);
 }