title: how to draw a circle and move it as an animation in C# WPF
body: <p>I would like to draw a simple circle and move it to the defined position on X,Y axis by coding. </p>
  
  <p>For example;</p>
  
  <p>There will be 2 buttons on WPF window and there will be a circle on 0,0(x,y). When I clicked on the 1st button, it will go to X = 150 and Y= 40. But the shape has to go there smoothly. I mean I dont want it to be disapear at the current position and appear on the defined position. I want it to go there. How should I do this? Can you explain me the steps? and if possible some example code ?</p>
  
  <p>UPDATED CODE:</p>
  
  <pre><code>    int X = 0;
      int Y = 0;
  
      public bool inside = true;
  
      private void Button_Click_1(object sender, RoutedEventArgs e)
      {
  
          if (inside)
          {
              DoubleAnimation animatex = new DoubleAnimation();
              animatex.To = X++;
              // animatex.Duration = new Duration(TimeSpan.FromSeconds(1));
              // animatex.RepeatBehavior = RepeatBehavior.Forever;
              el.BeginAnimation(Canvas.LeftProperty, animatex);
  
              DoubleAnimation animatey = new DoubleAnimation();
              animatey.To = Y++;
              // animatey.RepeatBehavior = RepeatBehavior.Forever;
              el.BeginAnimation(Canvas.TopProperty, animatey);
          }
      }
  </code></pre>