コード例 #1
0
        // Token: 0x06000D03 RID: 3331 RVA: 0x00030818 File Offset: 0x0002EA18
        private static Color?GetTargetColor(Timeline timeline, bool isEntering)
        {
            ColorAnimation colorAnimation = timeline as ColorAnimation;

            if (colorAnimation != null)
            {
                if (colorAnimation.From == null)
                {
                    return(colorAnimation.To);
                }
                return(colorAnimation.From);
            }
            else
            {
                ColorAnimationUsingKeyFrames colorAnimationUsingKeyFrames = timeline as ColorAnimationUsingKeyFrames;
                if (colorAnimationUsingKeyFrames == null)
                {
                    return(null);
                }
                if (colorAnimationUsingKeyFrames.KeyFrames.Count == 0)
                {
                    return(null);
                }
                ColorKeyFrame colorKeyFrame = colorAnimationUsingKeyFrames.KeyFrames[isEntering ? 0 : (colorAnimationUsingKeyFrames.KeyFrames.Count - 1)];
                return(new Color?(colorKeyFrame.Value));
            }
        }
コード例 #2
0
        private static ColorKeyFrame CreateColorKeyFrmas(KeyFrames <Color> Model)
        {
            ColorKeyFrame frame = null;

            switch (Model.Type)
            {
            case KeyFramesType.Spline: frame = new SplineColorKeyFrame()
            {
                    KeySpline = Model.Spline
            }; break;

            case KeyFramesType.Linear: frame = new LinearColorKeyFrame(); break;

            case KeyFramesType.Easing: frame = new EasingColorKeyFrame()
            {
                    EasingFunction = Model.EasingFunction
            }; break;

            case KeyFramesType.Discrete: frame = new DiscreteColorKeyFrame(); break;

            default: break;
            }
            frame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(Model.KeyTime));
            frame.Value   = Model.Value;
            return(frame);
        }
コード例 #3
0
        // These methods are used when generating a transition animation between states.
        // The timeline is the "to" state, and we need to find the To value for the
        // animation we're generating.
        private static Color?GetTargetColor(Timeline timeline, bool isEntering)
        {
            ColorAnimation ca = timeline as ColorAnimation;

            if (ca != null)
            {
                return(ca.From.HasValue ? ca.From : ca.To);
            }

            ColorAnimationUsingKeyFrames cak = timeline as ColorAnimationUsingKeyFrames;

            if (cak != null)
            {
                if (cak.KeyFrames.Count == 0)
                {
                    return(null);
                }

                ColorKeyFrame keyFrame = cak.KeyFrames[isEntering ? 0 : cak.KeyFrames.Count - 1];
                return(keyFrame.Value);
            }

            return(null);
        }
コード例 #4
0
 protected void ApplyColorKeyFrameProperties(ColorKeyFrame colorKeyFrame, DeterministicRandom random)
 {
     colorKeyFrame.Value   = Color;
     colorKeyFrame.KeyTime = KeyTime;
 }