Name
CanvasRenderingContext2D.scale( ): scale the user coordinate system of the canvas
Synopsis
void scale(floatsx
, floatsy
)
Arguments
-
sx, sy
The horizontal and vertical scaling factors.
Description
scale( )
adds a scale
transformation to the current transformation matrix of the canvas.
Scaling is done with independent horizontal and vertical scaling
factors. For example, passing the values 2.0 and 0.5 causes
subsequently drawn paths to be twice as wide and half as high as
they would otherwise have been. Specifying a negative value for
sx
causes X coordinates to be flipped
across the Y axis, and a negative value of
sy
causes Y coordinates to be flipped
across the X axis.
See Also
CanvasRenderingContext2D.rotate(
)
, CanvasRenderingContext2D.translate(
)
Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.