XAML代码:
<Window x:Class="线性插值动画.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="" Width="" Loaded="Window_Loaded"
>
<Grid>
<TextBlock Width="" Height="" Foreground="#326939" FontSize="" Name="textBlock1" Text="文字渐变效果"/>
</Grid>
</Window>
.CS代码:
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
namespace 线性插值动画
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
} private void Window_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
// 在此处添加事件处理程序实现。
DoubleAnimation da=new DoubleAnimation();
da.From=;
da.To=;
da.Duration=TimeSpan.FromSeconds();
this.textBlock1.BeginAnimation(TextBlock.OpacityProperty,da);
}
}
}