public GlitchText()
        {
            this.InitializeComponent();

            var backgroundWrapper = new TextToBrushWrapper
            {
                Text      = "TextAnimation",
                FontSize  = 90,
                Width     = 800,
                Height    = 110,
                FontColor = Colors.Red
            };

            var foregroundWrapper = new TextToBrushWrapper
            {
                Text      = "TextAnimation",
                FontSize  = 90,
                Width     = 800,
                Height    = 110,
                FontColor = Colors.Cyan
            };

            var imageVisual = Compositor.CreateSpriteVisual();

            imageVisual.Brush = CreateBrush(backgroundWrapper.Brush, foregroundWrapper.Brush, BlendEffectMode.Lighten);
            imageVisual.Size  = new Vector2(800, 110);

            var containerVisual = Compositor.CreateContainerVisual();

            containerVisual.Children.InsertAtBottom(imageVisual);


            var lineVisual = Compositor.CreateSpriteVisual();

            lineVisual.Brush = Compositor.CreateColorBrush(Colors.Black);
            lineVisual.Size  = new Vector2(800, 2);
            containerVisual.Children.InsertAtTop(lineVisual);

            ElementCompositionPreview.SetElementChildVisual(TextBackground, containerVisual);
            Loaded += (s, e) =>
            {
                StartOffsetAnimation(backgroundWrapper.Brush, TimeSpan.FromSeconds(0.95), TimeSpan.Zero);
                StartOffsetAnimation(foregroundWrapper.Brush, TimeSpan.FromSeconds(1.1), TimeSpan.FromSeconds(0.2));
                StartOffsetAnimation(lineVisual, TimeSpan.FromSeconds(10), TimeSpan.Zero);
            };
        }
        public TextToBrushWrapper CreateTextToBrushWrapper(double shadowOffsetX, Color shadowColor)
        {
            var result = new TextToBrushWrapper
            {
                Text             = Text,
                FontSize         = 90,
                Width            = 800,
                Height           = 110,
                FontColor        = Colors.White,
                Background       = new SolidColorBrush(Colors.Black),
                ShadowBlurAmount = 0,
                ShadowOffsetX    = shadowOffsetX,
                ShadowColor      = shadowColor
            };

            result.Brush.VerticalAlignmentRatio = 0;
            return(result);
        }
 private void StartHeightAnimation(TextToBrushWrapper brush, List <(double, double)> keyFrames, TimeSpan duration, TimeSpan delay)