In this paper, we introduce a design framework for variable gain integral controllers with the aim to improve transient performance of linear motion systems. In particular, we focus on the well-known tradeoff introduced by integral action, which removes steady-state errors caused by constant external disturbances, but may deteriorate transient performance in terms of increased overshoot. We propose a class of variable gain integral controllers (VGICs), which limits the amount of integral action if the error exceeds a certain threshold, in order to balance this tradeoff in a more desirable manner. The resulting nonlinear controller consists of a loop-shaped linear controller with a variable gain element. The utilization of linear controllers as a basis for the control design appeals to the intuition of motion control engineers therewith enhancing the applicability. For the add-on part of the nonlinear variable gain part of the controller, we propose an optimization strategy, which enables performance-optimal tuning of the variable gain based on measurement data. The effectiveness of VGIC is demonstrated in practice on a high-precision industrial scanning motion system.