Viewmodel Inertia

Hi all! How i can implement a viewmodel inertia like Viewmodel Inertia - YouTube in the first person shooter template?

What’s maths i need?

Thanks.