Move to

From Sim Innovations Wiki
Revision as of 16:46, 12 July 2018 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

_move_to(x, y)

_move_to is used to move the drawing pen to a new location.

Info This function may only be called within a canvas draw callback

Return value

This function won't return any value.

Arguments

# Argument Type Description
1 x Number This is the left pixel of the canvas where your pen go.
2 y Number This is the top pixel of the canvas where your pen go.

Example

canvas_id = canvas_add(0, 0, 200, 200)

canvas_draw(canvas_id, function()
  -- Queue a line from 100,100 to 200,200
  _move_to(100, 100)
  _line_to(200, 200)
  
  -- Stroke the line (line width 6)
  _stroke("red", 6)
end)
Output of code above