# AnimatedImageVector.Companion

Artifact: [androidx.compose.animation:animation-graphics](https://developer.android.com/jetpack/androidx/releases/compose-animation) [View Source](https://cs.android.com/search?q=file:androidx/compose/animation/graphics/vector/AnimatedImageVector.kt+class:androidx.compose.animation.graphics.vector.AnimatedImageVector.Companion) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.1.0) Common/All
- Cmn

  ```
  object AnimatedImageVector.Companion
  ```

*** ** * ** ***

Provide an empty companion object to hang platform-specific companion extensions onto.

## Summary

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/graphics/vector/AnimatedImageVector` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/animation/graphics/vector/AnimatedImageVector.Companion.https://developer.android.com/reference/kotlin/androidx/compose/animation/graphics/vector/AnimatedImageVector.Companion#(androidx.compose.animation.graphics.vector.AnimatedImageVector.Companion).animatedVectorResource(kotlin.Int)( id: @https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Load an `https://developer.android.com/reference/kotlin/androidx/compose/animation/graphics/vector/AnimatedImageVector` from an Android resource id. | android |

## Extension functions

### AnimatedImageVector.Companion.animatedVectorResource

android Artifact: [androidx.compose.animation:animation-graphics](https://developer.android.com/jetpack/androidx/releases/compose-animation) [View Source](https://cs.android.com/search?q=file:androidx/compose/animation/graphics/res/AnimatedVectorResources.android.kt+function:animatedVectorResource)

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

Load an `https://developer.android.com/reference/kotlin/androidx/compose/animation/graphics/vector/AnimatedImageVector` from an Android resource id.

```kotlin
import androidx.annotation.DrawableRes
import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
import androidx.compose.animation.graphics.res.animatedVectorResource
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
import androidx.compose.animation.graphics.vector.AnimatedImageVector
import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

@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 },
    )
}
```

| Parameters |
|---|---|
| `id: @https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the resource identifier |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/graphics/vector/AnimatedImageVector` | an animated vector drawable resource. |