I want to add parallax effect in jetpack compose

Viewed 327

I have two composable to navigate, one is Home and SettingScreen that act as different screens. I am using Nav Host to navigate between the compostables. I need that when I navigate to another screen then the background image work like parallax effect means that move to left little while navigating.

Home Composable:

@Composable
fun Home(navController: NavHostController) {
Image(
    modifier = Modifier
        .fillMaxSize()
        .padding(start = 35.dp)
        .alpha(0.1f),
    painter = painterResource(id = R.drawable.test_image),
    contentDescription = null,
    alignment = Alignment.BottomCenter,
)

SettingIcon(navController) }

SettingScreen Composable:

@Composable
fun SettingScreen(navController: NavHostController) {
BackIcon(navController) }
0 Answers
Related