Advertisement
Guest User

WPF

a guest
Mar 30th, 2012
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. using System;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Media;
  5. using System.Windows.Media.Animation;
  6. using System.Windows.Media.Effects;
  7.  
  8. namespace EffectsExample
  9. {
  10.     class Program
  11.     {
  12.         [STAThread]
  13.         public static void Main()
  14.         {
  15.             var window = new Window();
  16.             var viewbox = new Viewbox();
  17.             var oldText = new TextBlock();
  18.             var text = new TextBlock();            
  19.             var effect = new TransitionEffects.BandedSwirlTransitionEffect();
  20.             var animation = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(5)));
  21.             animation.RepeatBehavior = RepeatBehavior.Forever;
  22.             animation.AutoReverse = true;
  23.             viewbox.Stretch = Stretch.Fill;
  24.             oldText.Background = Brushes.DeepSkyBlue;
  25.             oldText.Foreground = Brushes.White;
  26.             oldText.Text = "Hello, world!";
  27.             text.Background = Brushes.White;
  28.             text.Foreground = Brushes.DeepSkyBlue;
  29.             text.Text = "Hello, world!";
  30.             text.Effect = effect;
  31.             viewbox.Child = text;
  32.             window.Content = viewbox;
  33.             effect.OldImage = new VisualBrush(oldText);
  34.             effect.BeginAnimation(TransitionEffects.RandomCircleRevealTransitionEffect.ProgressProperty, animation);            
  35.             new Application().Run(window);
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement