Cards
Cardsanimated
Sound Wave Pulse
Speaker card emitting a rhythmic sine-wave pulse drawn across the surface.
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 SoundWavePulse() {
val t = rememberInfiniteTransition(label = "sw")
val shift by t.animateFloat(
initialValue = 0f,
targetValue = (2 * PI).toFloat(),
animationSpec = infiniteRepeatable(
tween(1600, easing = LinearEasing),
),
label = "shift",
)
Card(
shape = RoundedCornerShape(20.dp),
modifier = Modifier.fillMaxWidth(),
) {
Column(Modifier.padding(16.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
Icon(Icons.Default.Speaker, contentDescription = null)
Spacer(Modifier.width(8.dp))
Text("Ambient Mode",
style = MaterialTheme.typography.titleSmall)
}
Spacer(Modifier.height(12.dp))
Canvas(
modifier = Modifier
.fillMaxWidth()
.height(48.dp),
) {
val path = Path()
val mid = size.height / 2
path.moveTo(0f, mid)
var x = 0f
while (x <= size.width) {
val y = mid + sin(x / 26f + shift) * 16f
path.lineTo(x, y)
x += 4f
}
drawPath(
path,
color = Color(0xFF34D399),
style = Stroke(4f, cap = StrokeCap.Round),
)
}
}
}
}