Assalam-O-Alaikum! Welcome to Programming Concepts.

Today we shall try creating an animation in C#. We'll be creating bouncing ball in C# Windows Forms Application. So let's get started.
Open up Visual Studio and Create a new project. Now create a Form as shown in figure below:


Here we have a "Ball". Actually it is the letter "O". You can use a ".png" image. Two Windows.Form.Panel. One is PanelX on X-axis and another is PanelY on Y-axis. I used them as boundaries. And I also used a Windows.Forms.Timer and I have named it as  Time.
Now let's code to animate the ball. Right Click on on the form and select View Code.

Insert following code in the code editor.

using System;
using System.Windows.Forms;
namespace BouncingBall
{
public partial class Form1 : Form
{
// Boundaries
int BoundaryX = 727;
int BoundaryY = 478; int vx = 3, vy = 3;
public Form1()
{
InitializeComponent();
Time.Start();
} private void Time_Tick(object sender, EventArgs e)
{ // After collision with boundaries
if(Ball.Left > BoundaryX || Ball.Left <= 0)
{
vx *= -3; // negative changes direction
} if(Ball.Top <= 0)
{
vy *= -3;
} if (Ball.Top > BoundaryY)
{
vy *= -1;
vy += 2; // after coliision with ground maximum height decreases each time
} vy++; // ball is always attracted by gravity if (Ball.Top > BoundaryY) Ball.Top = BoundaryY; Ball.Left = Ball.Left + vx;
Ball.Top = Ball.Top + vy;
}
}
}

Here's the video guide:

Enjoy!