---
title: "sampleMapsAtCellCentres"
description: "Makes map-driven props change per whole cell instead of per pixel, so a mapped dot size or line thickness grows cell by cell rather than being cut off mid-cell."
group: "paint"
groupTitle: "Painting"
categoryId: "patterns"
categorySlug: "patterns"
categoryTitle: "Patterns & tiling"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/patterns.ts#L163"
---

# sampleMapsAtCellCentres

Makes map-driven props change per whole cell instead of per pixel, so a mapped dot size or line thickness grows cell by cell rather than being cut off mid-cell.

```ts
sampleMapsAtCellCentres(slots: {
    cells: PropRef
    rotation?: PropRef
    props: string[]
}): GpuMapSampleUVs
```

Import `patterns` from `shaders/std` and use `patterns.sampleMapsAtCellCentres`.

Set it on the definition's `mapSampleUVs` field, not in `paint:`. Give it the same `cells` count and `rotation` (degrees) the pattern uses so the snapping matches the lattice. `props` lists the prop names to snap.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `slots` | `{
    cells: PropRef
    rotation?: PropRef
    props: string[]
}` |  |

## Example

```ts
mapSampleUVs: sampleMapsAtCellCentres({cells: p('cells'), rotation: p('rotation'), props: ['thickness', 'softness']})
```

> **Tip.** Only matters when a prop is driven by a map (an image or another layer). Plain values are unaffected.

## See also

- [`cellFrame`](/docs/primitives/patterns/cellframe) — The shared coordinate system of a tiled pattern: how many cells fit down the canvas height and how far the whole lattice is rotated.
- [`dotLattice`](/docs/primitives/patterns/dotlattice) — A mask of round dots on a square grid, with optional row stagger, drift and twinkle.
- [`gridLines`](/docs/primitives/patterns/gridlines) — Square grid lines drawn in a `cellFrame`, plus a per-cell shade for the fill.

## Used by

[DotGrid](/docs/components/dotgrid), [Grid](/docs/components/grid)