WPF实现TextBlock呼吸灯效果

拈花ヽ惹草 提交于 2020-02-29 13:31:07

 

实现代码

                            <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>

  

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!