WPF炫彩动画效果简单实例

来源:互联网 时间:1970-01-01

<Button >

<Button.Background> <LinearGradientBrush>
<GradientStop Color="Blue" Offset="0"></GradientStop>
<GradientStop Color="Black" Offset="0.5"></GradientStop>
<GradientStop Color="Blue" Offset="1"></GradientStop>
</LinearGradientBrush>
</Button.Background>
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard >
<ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color"
From="Black" To="White" Duration="0:0:2" AutoReverse="True" RepeatBehavior="Forever">
</ColorAnimation>
</Storyboard>
</BeginStoryboard>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Background.GradientStops[1].Offset"
From="0" To="1" Duration="0:0:2" AutoReverse="True" RepeatBehavior="Forever">
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>

效果图变化:

本文来自wpf之家的博客,原文地址:http://www.cnblogs.com/wpf123/archive/2011/07/01/2095436.html


相关阅读:
Top