Cards
Cardsanimated
Road Trip Distance
Road trip card with animated odometer counting up the total kilometers.
Installation
caveui components are copy-paste Jetpack Compose built entirely on Material 3 — there's no caveui dependency to add. Make sure Material 3 is on your classpath (it ships with the Compose BOM), then copy the Usage snippet below into your project.
kotlin
// build.gradle.kts (module)
dependencies {
implementation(platform("androidx.compose:compose-bom:2025.06.00"))
implementation("androidx.compose.material3:material3")
}Usage
kotlin
@Composable
fun RoadTripDistanceCard() {
val km = remember { Animatable(0f) }
LaunchedEffect(Unit) { km.animateTo(842f, tween(1600)) }
ElevatedCard(
modifier = Modifier.fillMaxWidth().padding(16.dp)
) {
Row(
Modifier.padding(20.dp),
verticalAlignment = Alignment.CenterVertically
) {
Canvas(Modifier.size(36.dp)) {
drawLine(
Color(0xFFF59E0B),
Offset(0f, size.height * 0.7f),
Offset(size.width, size.height * 0.7f),
4f, pathEffect = PathEffect.dashPathEffect(
floatArrayOf(8f, 6f)
)
)
}
Spacer(Modifier.width(16.dp))
Column {
Text("${km.value.toInt()} km",
style = MaterialTheme.typography.headlineSmall)
Text("LA → Las Vegas",
style = MaterialTheme.typography.bodySmall)
}
}
}
}