elye
04/09/2021, 9:28 AMFloatTweenSpec
or tween<Float>
, … FloatSpringSpec
or spring<Float>
?Colton Idle
04/09/2021, 9:52 AMDoris Liu
04/09/2021, 6:27 PMtween
and spring
for working with higher level animation API. Float*Spec
avoids boxing the Floats when you use the methods defined in that interface directly. But if you use it as an AnimationSpec
, it's no different than tween
and spring
elye
04/10/2021, 1:42 AMboxing the Floats
a little more…Doris Liu
04/10/2021, 2:45 AMFoo<Float>
). Float*Spec
interface declares methods that accept primitive Float type parameters, therefore no autoboxing is needed when you use those methods. (They are in fact used in the low level animation system when all data types have been converted to floats.) But if you were to use Float*Spec
as an AnimationSpec<Float>
to pass to high level animation APIs, none of those linked methods will be used. Therefore in that case there's not much difference between FloatSpringSpec
and SpringSpec<Float>
.elye
04/10/2021, 4:09 AMFloat
, then Float*Spec
would be more efficient.
• If we are not using Float
, we’ll have to use tween
or spring
• When using non-primitive Float
, then both are the same.Doris Liu
04/10/2021, 5:04 AMFloatAnimationSpec.getValue/VelocityFromNanos(...)
from your application in a manual animation use case. Otherwise, they will be both treated as AnimationSpec<Float>
and through AnimationSpec<T>.vectorize
get converted to AnimationVector-based animations to be used in Animation<T>
.Doris Liu
04/10/2021, 5:15 AMState<T>
. So the floats eventually are boxed anyways.