Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe ContributorsCount animation should only be at the beginning of screen transition #1001

Closed
kosenda opened this issue Sep 8, 2024 · 2 comments · Fixed by #1012 or #1030
Closed

Comments

@kosenda
Copy link
Contributor

kosenda commented Sep 8, 2024

Overview

I think it is a bit overstated to have the animation move every time the ContributorsCountItem is shown or hidden when scrolling after the animation has moved.

Screen_recording_20240908_123255.mp4

@Composable
internal fun ContributorsCountItem(
totalContributor: Int,
modifier: Modifier = Modifier,
) {
var targetValue by remember { mutableStateOf(0) }
val animatedTotalContributor by animateIntAsState(
targetValue = targetValue,
animationSpec = tween(
delayMillis = 300,
durationMillis = 1000,
easing = EaseOutQuart,
),
)
LaunchedEffect(totalContributor) {
targetValue = totalContributor
}
Column(
modifier = modifier
.padding(horizontal = 16.dp, vertical = 10.dp),
) {
Text(
text = stringResource(ContributorsRes.string.contributor_total),
style = MaterialTheme.typography.titleMedium,
)
Row(
horizontalArrangement = Arrangement.spacedBy(6.dp),
verticalAlignment = Alignment.Bottom,
) {
Text(
text = "$animatedTotalContributor",
style = MaterialTheme.typography.headlineLarge,
)
Text(
text = stringResource(ContributorsRes.string.contributor_person),
style = MaterialTheme.typography.headlineSmall,
)
}
Spacer(modifier = Modifier.height(16.dp))
HorizontalDivider()
}
}

@rocoand
Copy link
Contributor

rocoand commented Sep 8, 2024

I'd like to try this issue 🙋‍♀️

@takahirom
Copy link
Member

Thanks! Assgined!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment