Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

scale method

Scales the current context by the specified horizontal (x) and vertical (y) factors.

HTML Canvas 2D Context, Section 3Internet Explorer 9

 

Syntax


object.scale(x, y);

Parameters

x [in]

Type: number

The horizontal scaling factor, where 1 equals unity or 100% scale.

y [in]

Type: number

The vertical scaling factor.

Return value

This method does not return a value.

Standards information

Remarks

When you create a CanvasRenderingContext2D object, it has a transformation matrix that identifies the current state. The ICanvasRenderingContext2D::scale method modifies the transformation by multiplying the matrix by the specified factor. For example, context.scale(1,.5) halves the vertical (or y-axis) values that are used in context and leaves the horizontal (or x-axis) values the same. Similarly, context.scale(2,2) doubles the size of the graphics.

 

 

Community Additions

ADD
Show:
© 2015 Microsoft