Created
October 2, 2022 18:00
-
-
Save Skyyo/c4764fd1e5d3923a0f9281d566d3695f to your computer and use it in GitHub Desktop.
perf_snippet_20
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
@Composable | |
fun ModifierLambdasScreen() { | |
val scrollState = rememberScrollState() | |
BoxWrapper { | |
ScrollingArea(scrollState) | |
HorizontallyMovingButton(scrollState.value * 1.5f) | |
} | |
} | |
@Composable | |
private fun ScrollingArea(scrollState: ScrollState) { | |
Spacer(modifier = Modifier.verticalScroll(scrollState).height(2000.dp)) | |
} | |
@Composable | |
private fun HorizontallyMovingButton(scrollOffset: Float) { | |
Button(modifier = Modifier.graphicsLayer(translationX = scrollOffset)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment