David W
01/12/2022, 2:18 AMKirill Grouchnikov
01/12/2022, 2:31 AMDavid W
01/12/2022, 2:33 AMColton Idle
01/12/2022, 2:38 AMDavid W
01/12/2022, 2:39 AM> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61
val infiniteTransition = rememberInfiniteTransition()
val angle by infiniteTransition.animateFloat(
initialValue = 0F,
targetValue = 360F,
animationSpec = infiniteRepeatable(
animation = tween(1000, easing = FastOutLinearInEasing)
)
)
Icon(
painter = painterResource("refresh.svg"),
modifier = Modifier
.graphicsLayer {
if (areModsLoading) {
rotationZ = angle
}
},
contentDescription = "Refresh"
)
A graphicsLayer should be used when the content updates independently from anything above it to minimize the invalidated content.
Icon(
painter = painterResource("refresh.svg"),
modifier = Modifier
.run {
if (areModsLoading) {
val infiniteTransition = rememberInfiniteTransition()
val angle by infiniteTransition.animateFloat(
initialValue = 0F,
targetValue = 360F,
animationSpec = infiniteRepeatable(
animation = tween(1000, easing = FastOutLinearInEasing)
)
)
this.graphicsLayer { rotationZ = angle }
} else this
},
contentDescription = "Refresh"
)
infiniteTransition.animateFloat
outside of the conditional that, when true, made the icon spin, which was presumably causing the area to recompose, even though the graphicsLayer
code that used it was never calledDominaezzz
01/12/2022, 1:07 PMColton Idle
01/12/2022, 6:19 PM