如何使用WPF动画方式绘制曲线
1个回答
展开全部
别用路径动画了。
你可以这样试下。
<Storyboard x:"Storyboard1"> <DoubleAnimation From="0" To="1" Duration="0:0:5" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.GradientStops)[0].Offset" Storyboard.TargetName="path"/><DoubleAnimation From="0" To="1" Duration="0:0:5" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.GradientStops)[1].Offset" Storyboard.TargetName="path"/> </Storyboard>
<Path x:Name="path" Data="M 10,100 C 35,0 135,0 160,100 180,190 285,200 310,100" StrokeThickness="2"> <Path.Stroke><LinearGradientBrush EndPoint="1,0" StartPoint="0,0"> <GradientStop Color="Black" Offset="0"/> <GradientStop Color="Transparent" Offset="0"/> </LinearGradientBrush> </Path.Stroke> </Path>
你可以这样试下。
<Storyboard x:"Storyboard1"> <DoubleAnimation From="0" To="1" Duration="0:0:5" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.GradientStops)[0].Offset" Storyboard.TargetName="path"/><DoubleAnimation From="0" To="1" Duration="0:0:5" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.GradientStops)[1].Offset" Storyboard.TargetName="path"/> </Storyboard>
<Path x:Name="path" Data="M 10,100 C 35,0 135,0 160,100 180,190 285,200 310,100" StrokeThickness="2"> <Path.Stroke><LinearGradientBrush EndPoint="1,0" StartPoint="0,0"> <GradientStop Color="Black" Offset="0"/> <GradientStop Color="Transparent" Offset="0"/> </LinearGradientBrush> </Path.Stroke> </Path>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询