1
我想在WPF旋轉,在C#代碼的故事板簡單的網格 我的XAML代碼是如何在WPF C#代碼與故事板旋轉網格
<Window x:Class="rotate_test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:rotate_test"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid Name="my_grid">
<Button x:Name="button" Content="Button" HorizontalAlignment="Left" Margin="150,170,0,0" VerticalAlignment="Top" Width="75" Click="button_Click"/>
</Grid>
</Grid>
</Window>
有它 電網和一個按鈕onclick事件對於我使用的按鈕
Storyboard storyboard = new Storyboard();
DoubleAnimation rotateAnimation = new DoubleAnimation()
{
From = 0,
To = 360,
Duration = new Duration(TimeSpan.FromSeconds(10.0))
};
Storyboard.SetTarget(rotateAnimation, my_grid);
Storyboard.SetTargetProperty(rotateAnimation, new PropertyPath("(UIElement.RenderTransform).(RotateTransform.Angle)"));
storyboard.Children.Add(rotateAnimation);
storyboard.Begin();
但它不適用 我的問題是什麼? 如何設置動畫加速? thnx
tnx tnx tnx tnx –
你知道我該如何設置加速度嗎? –
看看我在答案中提到的屬性的在線文檔。你可能想要的是設置EasingFunction。請參閱此處:https://msdn.microsoft.com/en-us/library/ee308751(v=vs.100).aspx – Clemens