Can you point to an example?
I'm not aware of anything nothing built-in that does what you describe, so it's possible that what your'e seeing is just a special effect, either added by the screen-capture program used to record the video, or added in post-processing before the video was released.
For example, ScreenFlow (a popular screen capturing utility), touts it's ability:
During your screen capture, ScreenFlow tracks where your mouse cursor is, when you click and when you press a key. This allows you to add mouse click effects (both visual and audible) as an overlay showing your keystrokes and even lets you zoom the mouse pointer in and out.