Icons
Iconsanimated

Share

Three nodes that pop in as connecting links draw between them — the share graph.

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 ShareNodes(visible: Boolean) {
    val p by animateFloatAsState(if (visible) 1f else 0f, tween(700, easing = EaseOutBack), label = "share")
    val color = MaterialTheme.colorScheme.primary
    Canvas(Modifier.size(40.dp)) {
        val a = Offset(size.width * 0.78f, size.height * 0.2f)
        val b = Offset(size.width * 0.22f, size.height * 0.5f)
        val c = Offset(size.width * 0.78f, size.height * 0.8f)
        val line = ((p) ).coerceIn(0f, 1f)
        drawLine(color.copy(alpha = 0.7f), b, lerp(b, a, line), 2.dp.toPx())
        drawLine(color.copy(alpha = 0.7f), b, lerp(b, c, line), 2.dp.toPx())
        listOf(a, b, c).forEach { drawCircle(color, 4.dp.toPx() * p, it) }
    }
}