Exemplo n.º 1
0
 public void gameEndEffect(object sender, Tetris.GameBase.TetrisGame.GameEndEventArgs e)
 {
     this.Dispatcher.Invoke(
         new Action(
             delegate
     {
         DoubleAnimation d = new DoubleAnimation();
         d.From            = 255;
         d.To       = 1;
         d.Duration = new Duration(TimeSpan.FromMilliseconds(2000));
         this.BeginAnimation(Grid.OpacityProperty, d);
     }
             )
         );
 }
Exemplo n.º 2
0
        public void gameEndEffect(object sender, Tetris.GameBase.TetrisGame.GameEndEventArgs e)
        {
            this.Dispatcher.Invoke(
                new Action(
                    delegate
            {
                ColorAnimationUsingKeyFrames c = new ColorAnimationUsingKeyFrames();
                SolidColorBrush b = new SolidColorBrush();

                double beginTime = 800;
                double timeDelay = 500;
                double timeStep  = 000;
                c.KeyFrames.Add(new LinearColorKeyFrame(Colors.Transparent,
                                                        TimeSpan.FromMilliseconds(beginTime)));
                c.KeyFrames.Add(new LinearColorKeyFrame(Colors.White,
                                                        TimeSpan.FromMilliseconds(beginTime + timeDelay)));
                c.KeyFrames.Add(new LinearColorKeyFrame(Colors.White,
                                                        TimeSpan.FromMilliseconds(timeStep + beginTime + timeDelay)));;
                c.Completed += gameEnd;
                aRect.Fill.BeginAnimation(SolidColorBrush.ColorProperty, c);
            }
                    )
                );
        }