Canvas scale
Jump to navigation
Jump to search
Description
_scale(x, y)
_scale is used to scale all shapes drawn after this call in x and/or y axle.
Return value
This function won't return any value.
Arguments
# | Argument | Type | Description |
---|---|---|---|
1 | x | Number | X axle scaling |
2 | y | Number | Y axle scaling |
Example
canvas_add(0, 0, 200, 200, function()
-- Draw a red rectangle with rotation
_rect(0, 0, 100, 100)
_fill("red")
-- From this point everything is drawn twice as small, at 50%.
_scale(0.5, 0.5)
-- Draw a second blue rectangle
-- Because of the scale above, this will be drawn with a width of 50, and a height of 50
_rect(0, 0, 100, 100)
_fill("blue")
end)