I want to generate a straight line at bottom of a square and then move to line from bottom side of square to top side of square with a constant speed and want to see in plot at different times, where line exist (visualization).

I want to take different plots/image of line at different location rather than moving line from bottom to top.I mean, I want to show, at time t=0, line is at bottom, then after some time , it is at different position through images,means images for different time.