我正在向Canvas添加多个usercontrol。每个控件都有自己的故事板,可以在加载时执行。我注意到它在执行20秒动画时非常不稳定和生涩。这不是非常复杂,我希望有更好的表现。我应该留意的任何陷阱?以下是故事板的示例:
<Storyboard x:Key="mystoryboard" RepeatBehavior="Forever">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Effect).(BlurEffect.Radius)" Storyboard.TargetName="itemgroup">
<SplineDoubleKeyFrame KeyTime="0" Value="30"/>
<SplineDoubleKeyFrame KeyTime="0:0:4" Value="0"/>
<SplineDoubleKeyFrame KeyTime="0:0:8" Value="0"/>
<SplineDoubleKeyFrame KeyTime="0:0:10" Value="30"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="itemgroup">
<SplineDoubleKeyFrame KeyTime="0" Value="0"/>
<SplineDoubleKeyFrame KeyTime="0:0:2" Value="0.96"/>
<SplineDoubleKeyFrame KeyTime="0:0:4" Value="1"/>
<SplineDoubleKeyFrame KeyTime="0:0:7" Value="1"/>
<SplineDoubleKeyFrame KeyTime="0:0:8" Value="1"/>
<SplineDoubleKeyFrame KeyTime="0:0:10" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="itemgroup">
<SplineDoubleKeyFrame KeyTime="0" Value="0.1"/>
<SplineDoubleKeyFrame KeyTime="0:0:10" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="itemgroup">
<SplineDoubleKeyFrame KeyTime="0" Value="0.1"/>
<SplineDoubleKeyFrame KeyTime="0:0:10" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="itemgroup">
<SplineDoubleKeyFrame KeyTime="0" Value="-60"/>
<SplineDoubleKeyFrame KeyTime="0:0:10" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
答案 0 :(得分:1)
我注意到类似的情况与画布上的Shapes相对简单的故事板动画。对我来说,DropShadowEffect是罪魁祸首;删除阴影可以平滑动画。您的用户控件是否有任何效果?