In order to obtain high dynamic RMS performance of the scanning mirror in the working condition, the topology optimization method based on the constrain of dynamic deformation was carried out. Effective simplifications are implemented to reduce the complexity of the calculation. With the topology method, a lightweight form of the scanning mirror was generated on the dynamic working condition. The result shows that the lightweight ratio of the optimized structure is 47.4%, the PV value is 19.36nm and the RMS value is 5.65nm, which is improved by 18.46% and 17.41%, respectively. Besides, the first order frequency has increased by 113.8Hz. The results illustrate that the proposed method for the optimization of the scanning mirror is reasonable and practically.