We can modify the following code to allow a custom action to simplify rather than simplify
let t = Double(elapsedTime)/duration
...
let p = t*t*t*t*t
To better understand p, it is useful to build it as a functiont

Clearly, function decreases over the years. Change definition tto
let t = 1 - Double(elapsedTime)/duration
and building pgives

, 1 0. , p
let p = 1-t*t*t*t*t
