calculate elapsed time per frame to keep movement uniform