首页 > 代码库 > WPF 文本滚动效果 渐变效果

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 文本滚动效果 渐变效果