Does anyone know how I can get (or calculate) the ...
# compose
f
Does anyone know how I can get (or calculate) the duration of a
spring()
animation? Specifically, one that uses
Spring.StiffnessMedium
?
s
Springs afaik are specifically made in a way that you can't know the exact duration of. It depends on more factors than just the stiffness of it. If you're looking for a duration based approach you may have to look at some other API instead. What is your use case? What do you need that duration for?
a
I agree that duration-based animation might be better for your use case. That being said, you can get the duration with
spring<Float>(stiffness = Spring.StiffnessMedium).vectorize(Float.VectorConverter).getDurationNanos()
.