Esempio n. 1
0
        /// <summary>
        ///     Removes ease value related to a given path node index.
        /// </summary>
        /// <param name="nodeTimestamp">Path node timestamp.</param>
        private void HandleDisableEaseTool(float nodeTimestamp)
        {
            var easeCurveTimestamps =
                Utilities.GetAnimationCurveTimestamps(EaseCurve);

            // Find ease index for the given timestamp.
            var easeKeyIndex =
                easeCurveTimestamps.FindIndex(x => x == nodeTimestamp);

            if (easeKeyIndex != -1)
            {
                // Remove key from ease curve.
                EaseCurve.RemoveKey(easeKeyIndex);
            }

            Asserts.AssertToolCurveInSync(
                EasedNodesNo,
                EaseCurveKeysNo,
                "ease");

            // todo remove
            //var nodesWithEaseEnabledNo = GetEasedNodeTimestamps();

            //Utilities.Assert(
            //    () => EaseCurve.length == nodesWithEaseEnabledNo.Count,
            //    String.Format(
            //        "Number of ease curve keys and number of nodes" +
            //        " with enabled ease tool differs.\n" +
            //        "Ease curve length: {0}\n" +
            //        "Nodes with enabled ease tool: {1}",
            //        EaseCurve.length,
            //        nodesWithEaseEnabledNo.Count));
        }
Esempio n. 2
0
        public void RemoveKeyFromEaseCurve(float timestamp)
        {
            var index = Utilities.GetIndexAtTimestamp(EaseCurve, timestamp);

            EaseCurve.RemoveKey(index);

            OnEaseCurveUpdated();
        }
Esempio n. 3
0
        public void UpdateEaseValue(int keyIndex, float newValue)
        {
            var keyframeCopy = EaseCurve.keys[keyIndex];

            // Update keyframe value.
            keyframeCopy.value = newValue;

            // Replace old key with updated one.
            EaseCurve.RemoveKey(keyIndex);
            EaseCurve.AddKey(keyframeCopy);

            OnEaseCurveUpdated();
        }