按钮上的动画不流畅

时间:2019-07-03 13:50:37

标签: c# wpf

嗨,我正在此按钮上编写动画,但是它的滞后性没有继续。 它的每一帧都可以看一下

 <Button HorizontalAlignment="Right"
            Height="30" Width="100">
            <Button.Content>
                <Grid>
                    <Path Data="M0,0 L1,1 M0,1 L1,0" StrokeThickness="3" Margin="3" Stretch="Uniform" Stroke="Red" >
                        <Path.RenderTransform>
                            <RotateTransform x:Name="MyAnimatedTransform" Angle="0" />
                        </Path.RenderTransform>
                    </Path>
                </Grid>
            </Button.Content>
            <Button.Triggers>
                <EventTrigger RoutedEvent="Button.Click">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation
                Storyboard.TargetName="MyAnimatedTransform"
                Storyboard.TargetProperty="(RotateTransform.Angle)"
                From="0.0" To="360" Duration="0:0:2" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Button.Triggers>
        </Button>

0 个答案:

没有答案