Jetpack Compose
The Jiggicons library for Android apps built with Compose.
build.gradle.kts
dependencies {
implementation("com.jiggicons:jiggicons-compose:0.1.0")
}Inbox.kt
import com.jiggicons.JiggIcon
import com.jiggicons.JiggIconVariant
@Composable
fun Inbox() {
JiggIcon("bell", variant = JiggIconVariant.Solid, size = 32.dp, sound = true, contentDescription = "Notifications")
}Tap the icon and it plays. It works on Android 7.0 (API 24) and later. Motion is off when the system’s Remove animations setting is on.
Parameters
| Parameter | Default | |
|---|---|---|
variant | Outline | Outline, Solid, Duotone or Glass. Styles |
size | 24.dp | Width and height |
color | LocalContentColor | The icon’s colour. Glass keeps its own frosted greys |
sound | false | Play the icon’s spatial sound with its motion |
volume | 1f | Sound volume from 0 to 1 |
trigger | Tap | Tap, Appear or None |
state | null | A rememberJiggIconState() to play it from code |
contentDescription | null | Accessible name. Leave it out when the icon sits next to a visible label. Accessibility |
Play from code
val bell = rememberJiggIconState()
JiggIcon("bell", trigger = JiggIconTrigger.None, state = bell)
Button(onClick = { bell.play() }) { Text("Ring") }Sound
Each sound is made by the same synthesis as on the web, already placed between the two speakers along the path the icon moves, and ships in the library as a small .m4a file. Sounds play through SoundPool as interface sounds.
JiggiconsAudio.volume = 0.6fThe Compose library has the 80 free icons.