---
title: "CanvasPattern | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Interface CanvasPattern

The **`CanvasPattern`** interface represents an opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasPattern)

interface CanvasPattern {  
    [setTransform](#settransform-1)(transform?: [DOMMatrix2DInit](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.DOMMatrix2DInit/)): void;  
}

##### Index

### Methods[](#methods)

[setTransform](#settransform)

## Methods[](#methods-1)

### setTransform[](#settransform)

-   setTransform(transform?: [DOMMatrix2DInit](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.DOMMatrix2DInit/)): void[](#settransform-1)
    
    The **`CanvasPattern.setTransform()`** method uses a DOMMatrix object as the pattern's transformation matrix and invokes it on the pattern.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasPattern/setTransform)
    
    #### Parameters
    
    -   `Optional`transform: [DOMMatrix2DInit](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.DOMMatrix2DInit/)
    
    #### Returns void
