WPF breathing light effect achieved TextBlock

 

Implementation code

                            <TextBlock Text="录像中" FontSize="48" Foreground="#ED4646" HorizontalAlignment="Center" FontWeight="Medium" x:Name="TextBlockRecording">
                                <TextBlock.Triggers>
                                    <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                                        <BeginStoryboard>
                                            <Storyboard BeginTime="0:0:0" Duration="0:0:5" AutoReverse="True" RepeatBehavior="Forever">
                                                <ColorAnimation From="#ED4646" To="#F0F2F7" RepeatBehavior="Forever" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="TextBlockRecording">
                                                </ColorAnimation>
                                            </Storyboard>
                                        </BeginStoryboard>
                                    </EventTrigger>
                                </TextBlock.Triggers>
                            </TextBlock>

  

Guess you like

Origin www.cnblogs.com/wdw984/p/12382385.html