WPF动画之线性插值动画(1)

时间:2015-07-20 21:07:05   收藏:0   阅读:267

技术分享

XAML代码:

技术分享
1 <Window x:Class="线性插值动画.MainWindow"
2         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4         Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded" 
5         >
6     <Grid>
7         <TextBlock Width="220" Height="50" Foreground="#326939" FontSize="36" Name="textBlock1" Text="文字渐变效果"/>
8     </Grid>
9 </Window>
View Code

.CS代码:

技术分享
 1 using System;
 2 using System.Windows;
 3 using System.Windows.Controls;
 4 using System.Windows.Media.Animation;
 5 namespace 线性插值动画
 6 {
 7     /// <summary>
 8     /// MainWindow.xaml 的交互逻辑
 9     /// </summary>
10     public partial class MainWindow : Window
11     {
12         public MainWindow()
13         {
14             InitializeComponent();
15         }
16 
17         private void Window_Loaded(object sender, System.Windows.RoutedEventArgs e)
18         {
19             // 在此处添加事件处理程序实现。
20             DoubleAnimation da=new DoubleAnimation();
21             da.From=0;
22             da.To=1;
23             da.Duration=TimeSpan.FromSeconds(3);
24             this.textBlock1.BeginAnimation(TextBlock.OpacityProperty,da);
25        }
26     }
27 }
View Code

 

原文:http://www.cnblogs.com/zqhxl/p/4662487.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!