これ、おもしろい!!
👉 回転おじさん - Facebook
ちょっと画像をお借りして、
やってみましたが、、、
@Composable
fun Humans() {
var currentRotation by remember { mutableFloatStateOf(0f) }
val rotation = remember { Animatable(currentRotation) }
LaunchedEffect(Unit) {
rotation.animateTo(
targetValue = currentRotation + 360f,
animationSpec = infiniteRepeatable(
animation = tween(3000, easing = LinearEasing),
repeatMode = RepeatMode.Restart
)
) {
currentRotation = rotation.value
}
}
Image(
modifier = Modifier
.fillMaxSize()
.rotate(rotation.value)
.aspectRatio(1.0f),
painter = painterResource(R.drawable.humans),
contentDescription = null
)
}
ダメでした。。。
なんで、おじさんが走ってくれないのでしょうかー。
関連ワード: Android・AndroidStudio・JetpackCompose・Kotlin・おすすめ・初心者・開発