using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; // this one for Animation using System.Windows.Media.Animation; namespace WpfAnimationDouble1 { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void button1_Click(object sender, RoutedEventArgs e) { DoubleAnimation da = new DoubleAnimation(); da.From = 0; da.To = 360; var sec = DateTime.Now; da.Duration = new Duration(TimeSpan.FromSeconds(60)); da.RepeatBehavior = RepeatBehavior.Forever; RotateTransform rt = new RotateTransform(); rectangle1.RenderTransform = rt; rt.BeginAnimation(RotateTransform.AngleProperty, da); // DoubleAnimation da1 = new DoubleAnimation(); da1.From = 0; da1.To = 360; da1.Duration = new Duration(TimeSpan.FromMinutes(60)); da1.RepeatBehavior = RepeatBehavior.Forever; RotateTransform rt1 = new RotateTransform(); rectangle2.RenderTransform = rt1; rt1.BeginAnimation(RotateTransform.AngleProperty, da1); // DoubleAnimation da3 = new DoubleAnimation(); da3.From = 0; da3.To = 360; //da3.Duration = new Duration(TimeSpan.(60)); da3.Duration = new Duration(TimeSpan.FromHours(12)); da3.RepeatBehavior = RepeatBehavior.Forever; RotateTransform rt3 = new RotateTransform(); rectangle3.RenderTransform = rt3; rt3.BeginAnimation(RotateTransform.AngleProperty, da3); } } }