A semi-analytic method for dynamic response analysis based on Gurtin's variational principle