Cell-free massive multiple-input multiple-output (MIMO) which utilizes a certain number of distributed access points (APs) that connect to a central processing unit to serve all users in the network, arises much attention recently. Compared with APs on the ground, aerial APs can be flexibly deployed according to the distribution of users, which is especially suitable for the system with frequently-moving users or temporary emergency communication scenario. In this paper, we investigate a cell-free massive MIMO framework that use unmanned aerial vehicles (UAVs) as the aerial APs. By correlating the UAV altitude to line-of-sight and nonline-of-sight propagation model, we derive a closed-form achievable downlink sum rate of the system. Based on the analysis, the optimal UAV altitude and horizontal coordinates that maximize the downlink sum rate are obtained through an alternating optimization method. As users move, UAV APs in our system will move promptly to densely distribute in the area above crowded users, leading to a better system capacity.