Loaders
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
val t = rememberInfiniteTransition(label = "dna")
val phase by t.animateFloat(
initialValue = 0f,
targetValue = (2 * Math.PI).toFloat(),
animationSpec = infiniteRepeatable(tween(1400, easing = LinearEasing)),
label = "phase",
)
val c1 = MaterialTheme.colorScheme.primary
val c2 = MaterialTheme.colorScheme.tertiary
Canvas(Modifier.size(width = 48.dp, height = 28.dp)) {
val n = 6
repeat(n) { i ->
val x = size.width * i / (n - 1)
val s = sin(phase + i * 0.9f)
val y1 = size.height / 2f + s * size.height / 2.4f
val y2 = size.height / 2f - s * size.height / 2.4f
drawCircle(c1, 3.dp.toPx(), Offset(x, y1))
drawCircle(c2, 3.dp.toPx(), Offset(x, y2))
}
}