Arc to

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

_arc_to(cpx, cpy, x, y, radius)

_arc_to is used to draw a arc line from the pen location to the new location provided in the arguments. The control point and radius determine the arc of the line.

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 cpx Number This is the left pixel of the control point.
2 cpy Number This is the top pixel of the control point.
3 x Number This is the left pixel of the canvas where the end of your line should be.
4 y Number This is the top pixel of the canvas where the end of your line should be.
5 radius Number Radius of the arc in pixels

Example

canvas_id = canvas_add(0, 0, 200, 200, function()
  -- Create an arc line
  _move_to(20, 20)
  _line_to(100, 20)
  _arc_to(150, 20, 150, 70, 50)
  _line_to(150, 120)

  _stroke("red", 4)
end)
Output of code above