XAML Code:
1<window x:class="linear interpolation animations. MainWindow"2xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"3xmlns:x="Http://schemas.microsoft.com/winfx/2006/xaml"4title="MainWindow"height=" -"Width="525"Loaded="window_loaded" 5>6<Grid>7<textblock width=" -"height=" -"Foreground="#326939"Fontsize=" $"Name="TextBlock1"text="Text Gradient effect"/>8</Grid>9</Window>
View Code
. CS Code:
1 usingSystem;2 usingSystem.Windows;3 usingSystem.Windows.Controls;4 usingSystem.Windows.Media.Animation;5 namespacelinear interpolation animations6 {7 /// <summary>8 ///the interactive logic of MainWindow.xaml9 /// </summary>Ten Public Partial classMainwindow:window One { A PublicMainWindow () - { - InitializeComponent (); the } - - Private voidWindow_Loaded (Objectsender, System.Windows.RoutedEventArgs e) - { + //Add an event handler implementation here. -DoubleAnimation da=NewDoubleAnimation (); +Da. From=0; ADa. to=1; atDa. Duration=timespan.fromseconds (3); - This. Textblock1.beginanimation (Textblock.opacityproperty,da); - } - } -}
View Code
Linear interpolation animation for WPF animations (1)