# Fit

interface in `@dioramajs/diorama/effects`

```ts
import type { Fit } from '@dioramajs/diorama/effects'
```

A texture framed in the element's box like CSS object-fit.

```ts
interface Fit
```

## Members

| Name | Type | Description |
| --- | --- | --- |
| `mask` | `mask(at?: Node<'vec2'>): Node<'float'>` | 1 where the texture covers the box, 0 in contain bands, like the media's contain mask. |
| `sample` | `sample(at?: Node<'vec2'>): Node<'vec4'>` | The texture at box UV under the fit, clamped at its edge. Follows `set()`. |
| `set` | `set(texture: Texture, options?: FitOptions): void` | Swaps the texture (the next slide): same uniforms, no recompile. |
| `uv` | `uv(at?: Node<'vec2'>): Node<'vec2'>` | Box UV (y up) to the texture's UV under the fit. |

Also exported from `@dioramajs/effects`.

Defined in [packages/effects/src/types.ts](https://github.com/MasterKurosava/diorama/blob/main/packages/effects/src/types.ts#L373).
