Baltimore/New England Brady question

Just before New England scored its touchdown (I think)there was a running play for a first down where Brady set up as quarterback (seemingly) and then proceeded to bang on both sides of his helmet and raise both arms as the ball was snapped to the running back who ran for the first down (I think.)

Is this legal? Since running backs or flankers or whoever lines up in the backfield must remain stationary for some seconds before the ball is snapped, how is a person who is not getting the snap from center permitted to move any way he wants to deceive the opponets into thinking the snap is not coming?

they don’t throw flags against Brady

You can have exactly one person in the backfield in motion. Usually a RB switching sides, but this is legal.