我尝试使用Storyboard为TextBlock前景色设置动画。它在WPF中完美运行,但它似乎不适用于通用Windows。
这是我的代码:
store.dispatch(fetchLocations());
ReactDOM.render(<App store={store} />, mountpoint);
知道它为什么不能在通用Windows平台上运行吗?
由于
答案 0 :(得分:1)
您定义的动画被视为depended animation,因此,如果您设置EnableDependentAnimation="True",我会尝试它,但正如MSDN所说 - 请谨慎使用它。 / p>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<TextBlock x:Name="tbHello" Text="Hello World" FontSize="60" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock.Foreground>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0"
ColorInterpolationMode="ScRgbLinearInterpolation">
<GradientStop Color="#ff666666" Offset="-0.2" />
<GradientStop Color="#ffffffff" Offset="-0.1" />
<GradientStop Color="#ff666666" Offset="0" />
</LinearGradientBrush>
</TextBlock.Foreground>
<TextBlock.Triggers>
<EventTrigger>
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation Storyboard.TargetName="tbHello" EnableDependentAnimation="True"
Storyboard.TargetProperty="(TextElement.Foreground).(LinearGradientBrush.GradientStops)[0].(GradientStop.Offset)"
From="-0.2" To="1.5" Duration="0:0:1.5" />
<DoubleAnimation Storyboard.TargetName="tbHello" EnableDependentAnimation="True"
Storyboard.TargetProperty="(TextElement.Foreground).(LinearGradientBrush.GradientStops)[1].(GradientStop.Offset)"
From="-0.1" To="1.6" Duration="0:0:1.5" />
<DoubleAnimation Storyboard.TargetName="tbHello" EnableDependentAnimation="True"
Storyboard.TargetProperty="(TextElement.Foreground).(LinearGradientBrush.GradientStops)[2].(GradientStop.Offset)"
From="0" To="1.7" Duration="0:0:1.5" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</TextBlock.Triggers>
</TextBlock>
</Grid>