Michal Jezierski
03/02/2021, 1:59 PMStylianos Gakis
03/02/2021, 2:19 PMDoris Liu
03/03/2021, 2:36 AMAnimatable
values for changing the position of the UI, it's the best to read it from a graphicsLayer, e.g. Modifier.graphicsLayer {translationX = animatable.value}
because the invalidation would then be scoped to the draw stage (i.e. no recomposition or relayout would be needed).
If you need to use absoluteOffset
, consider the variant that takes a lambda. When you read the Animatable
value from that lambda, only layout and draw stages will be involved, i.e. no recomposition.
Either one would be more performant than recomposing every frame through Modifier.absoluteOffset(x=animatable.value)
🙂