Peng Wang
05/23/2022, 7:19 AMval state = mutableListOf(0f)
@Preview
@Composable
fun test() {
Box {
Button(onClick = {
state[0] += 100f
}) {
Text(" > ")
}
Canvas(Modifier.fillMaxSize()) {
drawCircle(color = Color.Red, center = Offset(state[0], 500f), radius = 200f)
}
}
}
Alexandre Elias [G]
05/24/2022, 12:03 AMZach Klippenstein (he/him) [MOD]
05/24/2022, 4:08 PMgraphicsLayer
modifier to see the difference. But layers have a significant cost, both in terms of memory and other things, so do not just start adding them everywhere. Drawing simple things like this circle is probably not worth it.