【发布时间】:2015-03-19 14:44:15
【问题描述】:
我在 windows phone 运行时应用中有一行。
<Line x:Name="Line1" Height="178" Width="166" Stretch="Fill" StrokeDashArray="4,4" StrokeThickness="1" Stroke="Black" X1="100" Y1="150" X2="105" Y2="108" RenderTransformOrigin="0.5,0.5">
我想为这条线设置动画,使其长度从(X1,Y1)开始增加并一直增加到(X2,Y2) em>,具有画线效果。
PS:我使用的是 Line 而不是 Path。
这是我所做的:
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Line1" Storyboard.TargetProperty="X2" EnableDependentAnimation="True">
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="101" />
<EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="102" />
<EasingDoubleKeyFrame KeyTime="0:0:4" Value="103" />
<EasingDoubleKeyFrame KeyTime="0:0:5" Value="104" />
<EasingDoubleKeyFrame KeyTime="0:0:8" Value="105" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Line1" Storyboard.TargetProperty="Y2" EnableDependentAnimation="True">
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="120" />
<EasingDoubleKeyFrame KeyTime="0:0:4" Value="110" />
<EasingDoubleKeyFrame KeyTime="0:1:0" Value="108" />
</DoubleAnimationUsingKeyFrames>
也尝试过ScaleTransform,但没有达到我的预期。
对此的任何解决方案将不胜感激。
【问题讨论】:
标签: windows-runtime windows-phone storyboard windows-phone-8.1 scaletransform