HTML canvas scale() Method
Example
let c = document.getElementById("myCanvas");
let ctx = c.getContext("2d");
ctx.strokeRect(25, 25, 50, 30);
ctx.scale(1.5, 1.5);
ctx.strokeRect(25, 25, 50, 30);
Meaning
The scale() method scales the current drawing bigger or smaller.
Standard Syntax
JavaScript syntax:
context.scale(scalewidth,scaleheight);
Advertisement
Parameter Values
| Parameter | Description |
|---|---|
| scalewidth | It scales the width of the current drawing. Ex: 1=100% |
| scaleheight | It scales the height of the current drawing. Ex: 1=100% |