我正在使用 UWP,并且正在尝试将使用关键帧的颜色动画应用到 UWP 社区工具包中的 DropShadowPanel。
但到目前为止我还没有成功,我已经能够将 DoubleAnimation 应用于 BlurRadius 属性和 Opacity 属性,但是每次我尝试应用彩色动画时,我的程序都会中断。
我还在我的画布上将颜色动画应用于多边形形状,效果很好,我使用几乎相同的代码,有人可以给我一个提示:
这是我的多边形中的代码,它可以工作:
<ColorAnimationUsingKeyFrames Storyboard.TargetName="ChristmasStarUpperPosition"
Storyboard.TargetProperty="(Polygon.Fill).(SolidColorBrush.Color)"
RepeatBehavior="Forever"
AutoReverse="True">
<LinearColorKeyFrame Value="Silver" KeyTime="0:0:5"/>
<LinearColorKeyFrame Value="LightGray" KeyTime="0:0:2"/>
<SplineColorKeyFrame Value="Gray" KeyTime="0:0:2.5" KeySpline="0.6,0.0 0.9,0.00"/>
<DiscreteColorKeyFrame Value="Blue" KeyTime="0:0:3"/>
<LinearColorKeyFrame Value="Blue" KeyTime="0:0:5"/>
<LinearColorKeyFrame Value="LightBlue" KeyTime="0:0:2"/>
<SplineColorKeyFrame Value="DeepSkyBlue" KeyTime="0:0:2.5" KeySpline="0.6,0.0 0.9,0.00"/>
<DiscreteColorKeyFrame Value="Goldenrod" KeyTime="0:0:3"/>
<LinearColorKeyFrame Value="Goldenrod" KeyTime="0:0:5"/>
</ColorAnimationUsingKeyFrames>
这是我试图应用于我的 DropShadowPanel 的代码,此代码使 mas 程序在 xaml 级别失败。
<ColorAnimationUsingKeyFrames Storyboard.TargetName="ChristmasBonusStarUpperDropShadowPolygonColor"
Storyboard.TargetProperty="(DropShadowPanel.Color).(SolidColorBrush.Color)"
RepeatBehavior="Forever"
AutoReverse="True">
<LinearColorKeyFrame Value="Silver" KeyTime="0:0:5"/>
<LinearColorKeyFrame Value="LightGray" KeyTime="0:0:2"/>
<SplineColorKeyFrame Value="Gray" KeyTime="0:0:2.5" KeySpline="0.6,0.0 0.9,0.00"/>
<DiscreteColorKeyFrame Value="Blue" KeyTime="0:0:3"/>
<LinearColorKeyFrame Value="Blue" KeyTime="0:0:5"/>
<LinearColorKeyFrame Value="LightBlue" KeyTime="0:0:2"/>
<SplineColorKeyFrame Value="DeepSkyBlue" KeyTime="0:0:2.5" KeySpline="0.6,0.0 0.9,0.00"/>
<DiscreteColorKeyFrame Value="Goldenrod" KeyTime="0:0:3"/>
<LinearColorKeyFrame Value="Goldenrod" KeyTime="0:0:5"/>
</ColorAnimationUsingKeyFrames>
希望有人能帮帮我!!!
谢谢!!!