> ## Documentation Index
> Fetch the complete documentation index at: https://rive.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MeshInstances

Holds the per instance data for `Renderer:drawImageMeshInstanced`. Unlike
the mesh buffers it is meant to be rewritten every frame.

## Methods

### `resize`

<div class="signature">
  ```lua theme={null}
  resize(count: number) -> ()
  ```
</div>

Sets the number of instances.

```lua theme={null}
local mi = MeshInstances()
mi:resize(3)
```

### `set`

<div class="signature">
  ```lua theme={null}
  set(index: number, transform: Mat2D, opacity: number?, additiveness: number?, uvTranslate: Vector?, uvScale: Vector?) -> ()
  ```
</div>

Writes the instance at `index`, which is zero based. Everything past
`transform` is optional.

```lua theme={null}
local mi = MeshInstances(2)
mi:set(0, Mat2D.withTranslation(Vector.xy(10, 20)))
mi:set(1, Mat2D.identity(), 0.5, 0, Vector.xy(0, 0), Vector.xy(0.5, 0.5))
```
