Cards
Cardsanimated

Journey Progress

Journey progress card with a plane sliding along an animated arc.

65% · 3h 10m left

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 JourneyProgressCard() {
  val p = remember { Animatable(0f) }
  LaunchedEffect(Unit) { p.animateTo(0.65f, tween(1800)) }
  Card(modifier = Modifier.fillMaxWidth().padding(16.dp)) {
    Column(Modifier.padding(20.dp)) {
      Canvas(Modifier.fillMaxWidth().height(60.dp)) {
        val y = size.height
        val path = Path().apply {
          moveTo(0f, y)
          quadraticBezierTo(
            size.width / 2, -y * 0.6f, size.width, y
          )
        }
        drawPath(
          path, Color.Gray.copy(0.3f),
          style = Stroke(3f)
        )
        val m = PathMeasure().apply { setPath(path, false) }
        val pos = FloatArray(2)
        m.getPosTan(m.length * p.value, pos, null)
        drawCircle(
          Color(0xFF6366F1), 8f, Offset(pos[0], pos[1])
        )
      }
      Spacer(Modifier.height(8.dp))
      Text("65% · 3h 10m left",
        style = MaterialTheme.typography.bodySmall)
    }
  }
}