I would like to move a picture accross a line to time.

For example, drawing a line with each end A and B respectively.
I would like to append the picture (most probably a tiny dot) to the line, starting from A, and move it to B over a certain period of time.

The problem is, how do I make the dot move exactly on the line to B, so that it also reaches B by the time I specify?

Any ideas ppl on how I can code this?