I'm having some issues with
rememberAnimatedVectorPainter
with an animated vector drawable from a resource, when the drawable contains a "translateXY" property (as seen in some AOSP classes). As far as I can tell, any animated vector drawable containing the object animator below will cause a crash. Is this a known issue, am I just being silly and doing something dumb, or should I report it?
<objectAnimator xmlns:android="<http://schemas.android.com/apk/res/android>"
xmlns:aapt="<http://schemas.android.com/aapt>"
android:propertyName="translateXY"
android:duration="500"
android:startOffset="0"
android:propertyXName="translateX"
android:propertyYName="translateY"
android:pathData="M 12.138,24C -1.1690000000000005,24 17.919,24 12.138,24">
<aapt:attr name="android:interpolator">
<pathInterpolator android:pathData="M 0.0,0.0 c0.333,0.168 0.667,1 1.0,1.0" />
</aapt:attr>
</objectAnimator>
And it is being referenced like this
@OptIn(ExperimentalAnimationGraphicsApi::class)
@Composable
fun BadgeIconImage() {
val image = AnimatedImageVector.animatedVectorResource(R.drawable.triangle_animated_vector)
var atEnd by remember { mutableStateOf(false) }
Image(
painter = rememberAnimatedVectorPainter(image, atEnd),
contentDescription = "Your content description",
modifier = Modifier.size(64.dp).clickable {
atEnd = !atEnd
}
)
}
where the triangle_animated_vector just uses the above object animator on a simple triangle.
I'm on version 1.1.1 of compose.