This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The Path2D
interface of the Canvas 2D API is used to declare paths that are then later used on CanvasRenderingContext2D
objects. The path methods of the CanvasRenderingContext2D
interface are present on this interface as well and are allowing you to create paths that you can retain and replay as required on a canvas.
Path2D()
Path2D
constructor. Creates a new Path2D
object.Path2D.addPath()
Path2D.closePath()
Path2D.moveTo()
Path2D.lineTo()
x, y
coordinates with a straight line.Path2D.bezierCurveTo()
moveTo()
before creating the Bézier curve.Path2D.quadraticCurveTo()
Path2D.arc()
Path2D.arcTo()
Path2D.ellipse()
Path2D.rect()
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of 'Path2D' in that specification. | Living Standard |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 31 (31) | Edge | (Yes) | 10 |
Path2D.addPath() | ? | ? | 34 (34) | No support | (Yes) | 10 |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 31.0 (31) | No support | (Yes) | No support |
Path2D.addPath() | ? | ? | 34.0 (34) | No support | (Yes) | No support |
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Path2D