CanvasContext.setTransform
Reset the transform and invoke the transform by unit matrix, the transform is described by the variable of the method.
Parameters
It is Object type.
Property | Type | Description |
scaleX | Number | Scale horizontally. |
skewX | Number | Skew horizontally. |
skewY | Number | Skew vertically. |
scaleY | Number | Scale vertically. |
translateX | Number | Translate horizontally. |
translateY | Number | Translate vertically. |
Sample Code
copy
//.js
const ctx = my.createCanvasContext('awesomeCanvas')
ctx.rotate(45 * Math.PI / 180)
ctx.setFillStyle('red')
ctx.fillRect(70,0,100,30)
ctx.setTransform(1, 1, 0, 1, 0, 0)
ctx.setFillStyle('#000')
ctx.fillRect(0, 0, 100, 100)
ctx.draw()