Name

CRC.closePath() — closes an open subpath

Synopsis

void closePath()

Description

If the current subpath of the canvas is open, closePath() closes it by adding a line connecting the current point to the first point of the subpath. It then begins a new subpath (as if by calling moveTo()) at that same point.

fill() and clip() treat all subpaths as if they had been closed, so you only need to call closePath() explicitly if you want to stroke() a closed path.

Get Canvas Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.