# CanvasRenderingContext2D.transform()

Onze vrijwilligers hebben dit artikel nog niet naar het Nederlands vertaald. Doe mee en help de klus te klaren!
U kunt het artikel ook in het English (US) lezen.

The CanvasRenderingContext2D.transform() method of the Canvas 2D API multiplies the current transformation with the matrix described by the arguments of this method. This lets you scale, rotate, translate (move), and skew the context.

Note: See also the setTransform() method, which resets the current transform to the identity matrix and then invokes transform().

## Syntax

void ctx.transform(a, b, c, d, e, f);


The transformation matrix is described by: $\left\left[ \begin\left\{array\right\}\left\{ccc\right\} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end\left\{array\right\} \right\right]$

### Parameters

a (m11)
Horizontal scaling. A value of 1 results in no scaling.
b (m12)
Vertical skewing.
c (m21)
Horizontal skewing.
d (m22)
Vertical scaling. A value of 1 results in no scaling.
e (dx)
Horizontal translation (moving).
f (dy)
Vertical translation (moving).

## Examples

### Skewing a shape

This example skews a rectangle both vertically (.2) and horizontally (.8). Scaling and translation remain unchanged.

#### HTML

<canvas id="canvas"></canvas>


#### JavaScript

const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');

ctx.transform(1, .2, .8, 1, 0, 0);
ctx.fillRect(0, 0, 100, 100);


## Specifications

Specification Status Comment
HTML Living Standard
The definition of 'CanvasRenderingContext2D.transform' in that specification.
Living Standard

## Browser compatibility

Update compatibility data on GitHub
Desktop Mobile Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Chrome Full support Yes Edge Full support 12 Firefox Full support 3 IE Full support Yes Opera Full support Yes Safari Full support Yes WebView Android Full support Yes Chrome Android Full support Yes Firefox Android Full support 4 Opera Android Full support Yes Safari iOS Full support Yes Samsung Internet Android Full support Yes

Full support
Full support