terminology – Is there a name for this kind of mini-game? (cursor moves on a bar, press key in part of the bar to win)

Today I played a game which has a mini-game in it, basically it looks like this:

here’s a bar:


and a cursor moves back and forth on it:

-|--------=====----------  ( cursor "|" moves in this direction -> )



----------=====---------|  ( when the cursor reaches the end, it goes back <-)

If I hit a key when the cursor is on the specific part of the bar (which I used the “=” sign to represent), I win. Otherwise I lose.

This kind of mini-game is pretty common as I’ve seen many variant of it in a lot of games, yet I don’t know the name of it. Does it have a name? What’s the origin of it?