Created
December 15, 2021 21:28
-
-
Save PiotrPrus/fd79fe0b7be2a411b3c1fedfd77eb426 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val animatable = remember { Animatable(0f) } | |
... | |
//Modifier.tapOrPress | |
onCompleted = { | |
scope.launch { | |
selectedPosition = it | |
animatable.snapTo(1f) | |
} | |
} | |
... | |
// @Composable Canvas | |
drawRoundRect( | |
brush = brush, | |
topLeft = Offset( | |
x = horizontalPadding + distance.times(selectedBar!!.index) - selectionWidth.div(2), | |
y = chartAreaHeight - chartAreaHeight.times(animatable.value)), // use of animatable value | |
size = Size(selectionWidth, chartAreaHeight), | |
cornerRadius = CornerRadius(cornerRadius) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment