开发者

Animation change from LinearGradientBrush to SolidColorBrush

Is it possible with an animation to change the Ellipse.Fill from a LinearGradientBrush to a SolidColorBrush or change the gradientStops w开发者_开发技巧ithin the LinearGradientBrush?


Maybe you should use two ellipses and dynamically change their opacity.


You can animate the individual gradient stops of a gradient brush (and by setting them to the same color, you'd get a 'solid' color) This is an example of animating the gradient set to the Panel.Background of some target:

<Storyboard>
  <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).
                    (GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                Storyboard.TargetName="sometarget">
    <EasingColorKeyFrame KeyTime="0"
                         Value="Blue" />
  </ColorAnimationUsingKeyFrames>
  <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).
                    (GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                Storyboard.TargetName="sometarget">
    <EasingColorKeyFrame KeyTime="0"
                         Value="Green" />
  </ColorAnimationUsingKeyFrames>
</Storyboard>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜