private void AnimationText()
        {
            m_txb            = new Label();
            m_txb.Content    = "Boas Festas!!! - Verax";
            m_txb.FontSize   = 120;
            m_txb.FontFamily = new FontFamily("Bauhaus 93");
            object          oo        = FontFamily.FamilyNames.Values;
            SolidColorBrush textBrush = new SolidColorBrush(Colors.Blue);

            m_txb.Foreground = textBrush;
            DropShadowEffect eff = new DropShadowEffect();

            eff.BlurRadius  = 25; // Color="LightGreen" ShadowDepth="0" Direction="0" BlurRadius="25"
            eff.Color       = Colors.Yellow;
            eff.ShadowDepth = 0;
            eff.Direction   = 0;
            m_txb.Effect    = eff;
            m_txb.SetValue(Canvas.LeftProperty, 10.0);
            m_txb.SetValue(Canvas.TopProperty, 10.0);
            mainPanel.Children.Add(m_txb);

            //create an animation
            DoubleAnimation da = new DoubleAnimation();
            DoubleAnimation db = new DoubleAnimation();

            BounceEase BounceOrientation = new BounceEase();

            BounceOrientation.Bounces    = 4;
            BounceOrientation.Bounciness = 2;

            ElasticEase elastic = new ElasticEase();

            elastic.Oscillations = 2;
            elastic.Springiness  = 2;
            Storyboard sb     = new Storyboard();
            CircleEase circle = new CircleEase();

            circle.Ease(13);

            //** db.EasingFunction = elastic; //elastic; // BounceOrientation;
            //set from animation to start position
            //dont forget set canvas.left for grid if u dont u will get error
            db.From = mainPanel.Width;
            //set second position of grid
            db.To = -1300;
            //set duration
            db.Duration       = new Duration(TimeSpan.FromSeconds(18));
            db.AutoReverse    = true;
            db.RepeatBehavior = RepeatBehavior.Forever;
            db.EasingFunction = circle; // BounceOrientation;
            da.From           = 0.0;
            da.To             = mainPanel.Height - 500;
            da.Duration       = new Duration(TimeSpan.FromSeconds(18));
            da.RepeatBehavior = RepeatBehavior.Forever;
            da.EasingFunction = elastic;
            //run animation if u want stop ,start etc use story board
            //*** m_veraxImage.BeginAnimation(Canvas.LeftProperty, da);
            sb.Children.Add(da);
            sb.Children.Add(db);

            // Register the brush's name

            this.RegisterName("Brush1", textBrush);

            LinearGradientBrushAnimation la = new LinearGradientBrushAnimation();

            var resources = App.Current.Resources.MergedDictionaries; // window1.Resources.MergedDictionaries;

            object o2 = (resources[1] as ResourceDictionary);         //.Values.GetEnumerator().Current; // as LinearGradientBrush));

            object[] keys = (o2 as ResourceDictionary).Keys as object[];
            la.From           = (o2 as ResourceDictionary)[keys[0]] as LinearGradientBrush;
            la.To             = (o2 as ResourceDictionary)[keys[1]] as LinearGradientBrush;
            la.RepeatBehavior = RepeatBehavior.Forever;
            la.AutoReverse    = true;
            la.Duration       = TimeSpan.FromSeconds(1);
            m_txb.Foreground  = (o2 as ResourceDictionary)[keys[0]] as LinearGradientBrush;
            m_txb.BeginAnimation(Label.ForegroundProperty, la);


            Storyboard.SetTarget(da, m_txb);
            Storyboard.SetTarget(db, m_txb);
            Storyboard.SetTargetProperty(db, new PropertyPath(Canvas.LeftProperty));
            Storyboard.SetTargetProperty(da, new PropertyPath(Canvas.TopProperty));
            //m_veraxTxb = new Action(delegate () {
            //    m_veraxImage.BeginAnimation(Canvas.LeftProperty, da);
            //    falaSerial.write(m_coresTexto[contaCor % m_cores.Length]);
            //    System.Diagnostics.Debug.WriteLine("m_veraxTxb.BeginAnimation(Canvas.LeftProperty, da...");
            //});
            System.Diagnostics.Debug.WriteLine("m_veraxTxb.BeginAnimation(Canvas.LeftProperty, db...");
            //m_txb.BeginAnimation(SolidColorBrush.ColorProperty, cc);
            sb.Begin();
            //m_txb.BeginAnimation(TextBlock.ForegroundProperty ,cc);
        }
        private void AnimationText()
        {
            Canvas mainPanel = canvas1;

            mainPanel.Background = Brushes.Black;
            m_txb            = new TextBlock();
            m_txb.Text       = "Boas Festas!!! - Verax---";
            m_txb.FontSize   = 80;
            m_txb.Foreground = Brushes.Lime;
            DropShadowEffect eff = new DropShadowEffect();

            eff.BlurRadius  = 25; // Color="LightGreen" ShadowDepth="0" Direction="0" BlurRadius="25"
            eff.Color       = Colors.Yellow;
            eff.ShadowDepth = 0;
            eff.Direction   = 0;
            m_txb.Effect    = eff;
            m_txb.SetValue(Canvas.LeftProperty, 10.0);
            m_txb.SetValue(Canvas.TopProperty, 10.0);
            mainPanel.Children.Add(m_txb);

            // m_txb.SetValue(Canvas.LeftProperty, 180.0);
            // m_txb.SetValue(Canvas.TopProperty, 1800.0);

            //create an animation

            DoubleAnimation db = new DoubleAnimation();



            BounceEase BounceOrientation = new BounceEase();

            BounceOrientation.Bounces    = 4;
            BounceOrientation.Bounciness = 2;

            ElasticEase elastic = new ElasticEase();

            elastic.Oscillations = 2;
            elastic.Springiness  = 2;

            CircleEase circle = new CircleEase();

            circle.Ease(3);

            //db.EasingFunction = circle; //elastic; // BounceOrientation;
            //set from animation to start position
            //dont forget set canvas.left for grid if u dont u will get error
            db.From = 400;
            //set second position of grid
            db.To = 00;
            //set duration
            db.Duration       = new Duration(TimeSpan.FromSeconds(3));
            db.AutoReverse    = true;
            db.EasingFunction = BounceOrientation;
            DoubleAnimation dc = db.Clone();

            dc.EasingFunction = elastic;
            Storyboard sb = new Storyboard();

            sb.Children.Add(db);
            sb.Children.Add(dc);
            Storyboard.SetTarget(db, m_txb);
            Storyboard.SetTarget(dc, m_txb);
            Storyboard.SetTargetProperty(db, new PropertyPath(Canvas.TopProperty));
            Storyboard.SetTargetProperty(dc, new PropertyPath(Canvas.LeftProperty));
            //Storyboard.SetTargetProperty(db, Canvas.LeftProperty);
            GradientStopCollection gcolFrom = new GradientStopCollection();

            gcolFrom.Add(new GradientStop(Colors.Black, 10));
            GradientStopCollection gcolTo = new GradientStopCollection();

            gcolFrom.Add(new GradientStop(Colors.Red, 10));
            LinearGradientBrushAnimation linan = new LinearGradientBrushAnimation();

            linan.From = new LinearGradientBrush(gcolFrom, 90);
            linan.To   = new LinearGradientBrush(gcolTo, 90);

            this.RegisterName("linan", linan);
            sb.Children.Add(linan);
            Storyboard.SetTargetName(linan, "linan");
            Storyboard.SetTargetProperty(linan, new PropertyPath(TextBlock.ForegroundProperty));
            System.Diagnostics.Debug.WriteLine("m_veraxTxb.BeginAnimation(Canvas.LeftProperty, db...");
            //m_txb.BeginAnimation(Canvas.LeftProperty, db);
            canvas1.Resources.Add("unique_id", sb);
            sb.Begin();
        }
 private static void AnimationFunction_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     LinearGradientBrushAnimation animation = (LinearGradientBrushAnimation)d;
     //animation.PropertyChanged(e.Property);
 }