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(
)
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access