I want to create an animation moving object .. in order to move this object i need to update the coordinates x and y or one of them, the problem is the object is jamb to the final position with no smooth moving animation as suppose to... I used thread sleep but doesn't just make the code freeze then the object jamb.. Here is the not working part of the code
public void t_Tick(object sender, EventArgs e)
{
if (flag)
{
for (int i = 0; i < 100; i = i + 1)
{
x-position = x-position + 3;
Invalidate();
Thread.Sleep(5000);//instead of stop for 5 second and continue the loop is stop 5 second and go to i=100 the final value in the loop
}
flag = false;
}
}