Beispiel #1
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;
 }
Beispiel #2
0
        private void InitializeTurnOnStoryBoardAnimation()
        {
            ColorAnimationUsingKeyFrames ckf = new ColorAnimationUsingKeyFrames();

            Storyboard.SetTargetProperty(TurnOnAnimation, new PropertyPath("Color"));
            Storyboard.SetTarget(TurnOnAnimation, backgroundBrush);

            LinearColorKeyFrame lck0 = new LinearColorKeyFrame();
            lck0.KeyTime = TimeSpan.FromMilliseconds(300);
            lck0.Value = accentColor;

            ckf.KeyFrames.Add(lck0);
            TurnOnAnimation.Children.Add(ckf);
        }
Beispiel #3
0
        private void CreatePhaseBackgroundAnimation()
        {
            _phaseBackgroundAnimation = new Storyboard();
            _backgroundBrush = (SolidColorBrush)LayoutRoot.Background;
            ColorAnimationUsingKeyFrames ckf = new ColorAnimationUsingKeyFrames();

            Storyboard.SetTargetProperty(_phaseBackgroundAnimation, new PropertyPath("Color"));
            Storyboard.SetTarget(_phaseBackgroundAnimation, _backgroundBrush);

            LinearColorKeyFrame lck0 = new LinearColorKeyFrame();
            lck0.KeyTime = TimeSpan.FromMilliseconds(500);
            lck0.Value = ColorConverter.Convert(App.GameManager.GameData.GameSettings.BackgroundColor);

            ckf.KeyFrames.Add(lck0);
            _phaseBackgroundAnimation.Children.Add(ckf);
        }