WPF 文本滚动效果 渐变效果

Posted TeemoHQ

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了WPF 文本滚动效果 渐变效果相关的知识,希望对你有一定的参考价值。

 1 <DockPanel>
 2         <StackPanel DockPanel.Dock="Bottom" VerticalAlignment="Bottom"  ClipToBounds="True">
 3             <DockPanel Name="content1">
 4                 <DockPanel.RenderTransform>
 5                     <TranslateTransform Y="0" />
 6                 </DockPanel.RenderTransform>
 7                 <TextBlock Margin="-600,0,0,0" HorizontalAlignment="Right" FontSize="40" Foreground="Green" Text="其他患者请耐心等候" />
 8             </DockPanel>
 9             <StackPanel.Triggers>
10                 <EventTrigger RoutedEvent="Loaded">
11                     <BeginStoryboard>
12                         <Storyboard>
13                             <DoubleAnimation From="0" To="-1250" Duration="0:0:9"
14                                         RepeatBehavior="Forever"
15                                         Storyboard.TargetName="content1" 
16                                         Storyboard.TargetProperty="RenderTransform.X" />
17                         </Storyboard>
18                     </BeginStoryboard>
19                 </EventTrigger>
20             </StackPanel.Triggers>
21         </StackPanel>
22         <StackPanel DockPanel.Dock="Top">
23             <TextBlock Text="123" Foreground="Black" FontSize="49" Name="PatientNameTb"></TextBlock>
24             <StackPanel.Triggers>
25                 <EventTrigger RoutedEvent="Loaded">
26                     <BeginStoryboard>
27                         <Storyboard ><!--可以试颜色变化,也可以是透明度变化-->
28                             <!--<ColorAnimation BeginTime="00:00:00"
29                                                         From="#3F5376" To="#FEE5D1"
30                                                         Duration="00:00:01"
31                                                         AutoReverse="True"
32                                                         RepeatBehavior="Forever"
33                                                         Storyboard.TargetName="PatientNameTb" 
34                                                         Storyboard.TargetProperty="Foreground.Color" />-->
35                             <DoubleAnimation BeginTime="00:00:00"
36                                                         From="0" To="1"
37                                                         Duration="00:00:01"
38                                                         AutoReverse="True"
39                                                         RepeatBehavior="Forever"
40                                                         Storyboard.TargetName="PatientNameTb" 
41                                                         Storyboard.TargetProperty="Opacity" />
42                         </Storyboard>
43                     </BeginStoryboard>
44                 </EventTrigger>
45             </StackPanel.Triggers>
46         </StackPanel>
47     </DockPanel>

 

以上是关于WPF 文本滚动效果 渐变效果的主要内容,如果未能解决你的问题,请参考以下文章

WPF window 子窗口反馈效果(抖动/阴影渐变)

WPF C#实现动画(速度启停缓动线性渐变)

WPF window 子窗口反馈效果(拉动/渐变)

WPF中ListBox滚动时的缓动效果

WPF 有趣的动画效果

CSS3的渐变文本效果字体