[null,null,["最后更新时间 (UTC):2025-08-23。"],[],[],null,["# Animated vector images in Compose\n\nAnimating vectors in Compose is possible in a few different ways. You can use any of the following:\n\n- `AnimatedVectorDrawable` file format\n- `ImageVector` with Compose animation APIs, like in [this Medium article](https://medium.com/androiddevelopers/making-jellyfish-move-in-compose-animating-imagevectors-and-applying-agsl-rendereffects-3666596a8888)\n- A third-party solution like [Lottie](https://airbnb.design/lottie/)\n\nAnimated vector drawables (experimental)\n----------------------------------------\n\n**Figure 1.** Animated vector drawable in Compose\n\nTo use an [`AnimatedVectorDrawable`](/reference/android/graphics/drawable/AnimatedVectorDrawable) resource, load up the drawable file using `animatedVectorResource` and pass in a `boolean` to switch between the start and end state of your drawable, performing the animation.\n\n\n```kotlin\n@Composable\nfun AnimatedVectorDrawable() {\n val image = AnimatedImageVector.animatedVectorResource(R.drawable.ic_hourglass_animated)\n var atEnd by remember { mutableStateOf(false) }\n Image(\n painter = rememberAnimatedVectorPainter(image, atEnd),\n contentDescription = \"Timer\",\n modifier = Modifier.clickable {\n atEnd = !atEnd\n },\n contentScale = ContentScale.Crop\n )\n}https://github.com/android/snippets/blob/dd30aee903e8c247786c064faab1a9ca8d10b46e/compose/snippets/src/main/java/com/example/compose/snippets/animations/AnimationSnippets.kt#L915-L927\n```\n\n\u003cbr /\u003e\n\nFor more information about the format of your drawable file, see [Animate drawable graphics](/guide/topics/graphics/drawable-animation).\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [Loading images {:#loading-images}](/develop/ui/compose/graphics/images/loading)"]]