Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Animate the Opacity of TextBlock at different starting time

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         Title="Animation"> <Grid Background="Black" TextBlock.Foreground="White" TextBlock.FontSize="30">   <Grid.Triggers>     <EventTrigger RoutedEvent="Grid.Loaded">       <BeginStoryboard>         <Storyboard TargetProperty="Opacity" RepeatBehavior="Forever">           <DoubleAnimation Storyboard.TargetName="title1" BeginTime="0:0:2"           From="0" To="1" Duration="0:0:2" AutoReverse="True"/>           <DoubleAnimation Storyboard.TargetName="title2" BeginTime="0:0:6"           From="0" To="1" Duration="0:0:2" AutoReverse="True"/>           <DoubleAnimation Storyboard.TargetName="title3" BeginTime="0:0:10"           From="0" To="1" Duration="0:0:2" AutoReverse="True"/>         </Storyboard>       </BeginStoryboard>     </EventTrigger>   </Grid.Triggers>   <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0" Name="title1">A</TextBlock>   <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0" Name="title2">B</TextBlock>   <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0" Name="title3">C</TextBlock> </Grid> </Window>