MoveKey() public method

Moves the key by the given offset. It will actually remove the old key from the curve and add a new offseted curve.
public MoveKey ( float positionOffset, float valueOffset ) : void
positionOffset float
valueOffset float
return void
Example #1
0
 /// <summary>
 /// Performs the actual movement of the keys.
 /// </summary>
 private void ScaleKeys(Point newMin, Point newMax)
 {
     for (int i = 0; i < affectedKeys.Length; i++)
     {
         // Remap to the new box;
         Point      newPosition = new Point((newMax.X - newMin.X) * normalizedPos[i].X + newMin.X, (newMax.Y - newMin.Y) * normalizedPos[i].Y + newMin.Y);
         KeyWrapper k           = Control.Keys[affectedKeys[i]];
         k.MoveKey((float)(newPosition.X - k.Key.Position), (float)(newPosition.Y - k.Key.Value));
     }
 }
Example #2
0
        /// <summary>
        /// Performs the actual movement of the keys.
        /// </summary>
        private void MoveKeys(float positionOffset, float valueOffset)
        {
            List <CurveWrapper> affectedCurves = new List <CurveWrapper>();

            for (int i = 0; i < affectedKeys.Length; i++)
            {
                KeyWrapper key = Control.Keys[affectedKeys[i]];
                key.MoveKey(positionOffset, valueOffset);

                // Create the set of curve affected by this move so we can recalculate
                // the auto tangents.
                if (!affectedCurves.Contains(key.Curve))
                {
                    affectedCurves.Add(key.Curve);
                }
            }

            // Compute all auto tangents.
            foreach (CurveWrapper curve in affectedCurves)
            {
                curve.ComputeTangents();
            }
        }