---
title: "animatedVectorResource"
description: "Load an [AnimatedImageVector] from an Android resource id."
type: "composable"
---

<div class='type'>Composable Function</div>


<a id='references'></a>

<div class='sourceset sourceset-android'>Android</div>


```kotlin
@Composable
public fun AnimatedImageVector.Companion.animatedVectorResource(
    @DrawableRes id: Int
): AnimatedImageVector
```


Load an `AnimatedImageVector` from an Android resource id.

#### Parameters

| | |
| --- | --- |
| id | the resource identifier |


#### Returns

| | |
| --- | --- |
|  | an animated vector drawable resource. |





## Code Examples
### AnimatedVectorSample
```kotlin
@Composable
fun AnimatedVectorSample() {
    @OptIn(ExperimentalAnimationGraphicsApi::class)
    @Composable
    fun AnimatedVector(@DrawableRes drawableId: Int) {
        val image = AnimatedImageVector.animatedVectorResource(drawableId)
        var atEnd by remember { mutableStateOf(false) }
        Image(
            painter = rememberAnimatedVectorPainter(image, atEnd),
            contentDescription = "Your content description",
            modifier = Modifier.size(64.dp).clickable { atEnd = !atEnd },
        )
    }
}
```

