巴比伦之塔 发表于 2012-12-19 21:09:48

WPF动画

WPF动画

<div id="cnblogs_post_body">一,使用DoubleAnimation创建动画
<div class="cnblogs_code">//1,创建剧本Storyboard storyboard = new Storyboard();//2,创建动画DoubleAnimation doubleAnimation = new DoubleAnimation(      valueStart,//起始值      valueEnd,//终点值      new Duration(TimeSpan.FromMilliseconds(1000s))//动画时间域       );//3,TargetStoryboard.SetTarget(doubleAnimation, rect);//Target对象Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("(Canvas.Left)"));//Target属性//4,在剧本中添加动画storyboard.Children.Add(doubleAnimation);//5,在资源中添加剧本if(!Resources.Contains("animation")){  Resources.Add("animation", storyboard);}//6,开始storyboard.Begin();
页: [1]
查看完整版本: WPF动画