Beispiel #1
0
        /// <inheritdoc/>
        public sealed override void AddPoint(WindowsPoint point)
        {
            var realPoint = InverseTransformPoint(point);

            // Make sure the curve is sampled
            UnderlyingCurve.UpdateChanges();
            // Evaluate the current value
            var value = UnderlyingCurve.Evaluate(realPoint.X);

            UpdateComponent(ref value, realPoint);
            var keyFrame = new AnimationKeyFrame <TValue>
            {
                Key   = realPoint.X,
                Value = value,
            };
            var index = GetInsertIndex(realPoint);

            KeyFramesNode.Add(keyFrame, index);
        }
        /// <inheritdoc/>
        public override void AddPoint(WindowsPoint point)
        {
            var realPoint = InverseTransformPoint(point);

            // Make sure the curve is sampled
            UnderlyingCurve.UpdateChanges();
            // Evaluate the current value
            var value = UnderlyingCurve.Evaluate(realPoint.X);

            // Update the component that is handled by this curve
            switch (Component)
            {
            case VectorComponent.X:
                value.X = realPoint.Y;
                break;

            case VectorComponent.Y:
                value.Y = realPoint.Y;
                break;

            case VectorComponent.Z:
                value.Z = realPoint.Y;
                break;

            case VectorComponent.W:
                value.Z = realPoint.Y;
                break;

            default:
                throw new NotSupportedException();     // This should never happen
            }
            // Create a new keyframe
            var keyFrame = new AnimationKeyFrame <Quaternion>
            {
                Key   = realPoint.X,
                Value = value,
            };
            var index = GetInsertIndex(realPoint);

            KeyFramesNode.Add(keyFrame, index);
        }