lilypuchi
bounce
bounce.animateTo(..)
onClick
@Composable fun Bouncy(modifier: Modifier = Modifier) { val bounce = animatedFloat(initVal = 0f) Box(modifier = modifier .size(width = 150.dp, height = 50.dp) .clip(shape = GenericShape { val height = it.height * bounce.value relativeMoveTo(0f, 0f) relativeLineTo(it.width / 2, height) relativeLineTo(it.width / 2, -height) }) .background(color = Color.Red) .clickable(onClick = { bounce.animateTo( targetValue = 1f, anim = spring( dampingRatio = Spring.DampingRatioMediumBouncy, stiffness = Spring.StiffnessLow ), ) }) ) }
Jeisson Sáchica
Doris Liu
.clickable(..)
.size(...)
A modern programming language that makes developers happier.