I've written a spring simulation for a UI in JavaScript, and everything is going great, users are able to throw UI elements all over the place and have them slide right where they need to go with a little wiggle.
However I'm trying to chain spring simulations together, and I'd like to know what time a spring will cross its equilibrium point so that I can ready the next animation in the chain to start at the right time and velocity.
How can I solve this formula for $t$ so I can know when the spring will cross a certain point? I'd like to know for all types of springs, but practically I'm only working with slightly underdamped ones. My current formula for finding an underdamped spring's displacement from its equilibrium is $$ f(t) = e^{-ct/2m} * (d_0 * cos(\frac{\sqrt{4mk - c^2}*t}{2m}) + \frac{2mv_0+cd_0}{\sqrt{4mk-c^2}} * sin(\frac{\sqrt{4mk - c^2}*t}{2m})) $$ where:
$m$: the mass of the springing object,
$k$: the stiffness of the spring, the spring constant,
$c$: the damping force,
$d_0$: the springing object's initial distance from its equilibrium at $time = 0$ ,
$v_0$: the springing object's velocity once the user lets go of it at $time = 0$,
and $t$ for time.
Can I solve this mess for $t$ rather than $f(t)$?