window.CanvasRenderingContext2D
See: Web APIs - CanvasRenderingContext2D for more details<br></br> Also, refer to the interface HTMLCanvasElement<br></br>
Since: v7.0.0
CanvasRenderingContext2D()
Creates an instance of CanvasRenderingContext2D.
lineWidth : number
Get the thickness of lines.
See: CanvasRenderingContext2D - lineWidth for more details
lineJoin : string
Get the shape used to join two line segments where they meet.
See: CanvasRenderingContext2D - lineJoin for more details
lineCap : string
Get the shape used to draw the end points of lines.
See: CanvasRenderingContext2D - lineCap for more details
globalAlpha : number
Get the global alpha(transparency) value.
See: CanvasRenderingContext2D - globalAlpha for more details
fillStyle : string | CanvasGradient
Get the fill style used inside shapes.
See: CanvasRenderingContext2D - fillStyle for more details
strokeStyle : string
Get the color to use for the strokes (outlines) around shapes.
See: CanvasRenderingContext2D - strokeStyle for more details
createLinearGradient(x0, y0, x1, y1)
Creates a gradient along the line connecting two given coordinates.
Returns: CanvasGradient - A linear CanvasGradient object initialized with the specified line.
Throws:
DOMException
See: CanvasRenderingContext2D - createLinearGradient for more details
numbernumbernumbernumbercreateRadialGradient(x0, y0, r0, x1, y1, r1)
Creates a radial gradient using the size and coordinates of two circles.
Returns: CanvasGradient - A radial CanvasGradient object initialized with the two specified circles.
Throws:
DOMException
See: CanvasRenderingContext2D - createRadialGradient for more details
numbernumbernumbernumbernumbernumberbeginPath()
Creates a new path.
See: CanvasRenderingContext2D - beginPath for more details
closePath()
Add a straight line from the current point to the start of the current sub-path.
See: CanvasRenderingContext2D - closePath for more details
moveTo(x, y)
Begins a new sub-path at the point specified by the given (x, y) coordinates.
See: CanvasRenderingContext2D - moveTo for more details
numbernumberlineTo(x, y)
Adds a straight line to the current sub-path by connecting the sub-path's last point to the specified (x, y) coordinates.
See: CanvasRenderingContext2D - lineTo for more details
numbernumberarc(x, y, radius, startAngle, endAngle, counterclockwise)
Adds a circular arc to the current sub-path.
See: CanvasRenderingContext2D - arc for more details
numbernumbernumbernumbernumberbooleanfalsearcTo(x1, y1, x2, y2, radius)
Adds a circular arc to the current sub-path, using the given control points and radius.
See: CanvasRenderingContext2D - arcTo for more details
numbernumbernumbernumbernumberbezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)
Adds a cubic Bézier curve to the current sub-path.
See: CanvasRenderingContext2D - bezierCurveTo for more details
numbernumbernumbernumbernumbernumberquadraticCurveTo(cpx, cpy, x, y)
Adds a quadratic Bézier curve to the current sub-path.
See: CanvasRenderingContext2D - quadraticCurveTo for more details
numbernumbernumbernumberrect(x, y, width, height)
Adds a rectangle to the current path.
See: CanvasRenderingContext2D - rect for more details
numbernumbernumbernumberstroke(path)
Strokes (outlines) the current or given path with the current stroke style.
See: CanvasRenderingContext2D - stroke for more details
Path2Dfill(pathOrFillRule)
Fills the current or given path with the current fillStyle.<br></br>
See: CanvasRenderingContext2D - fill for more details
Path2D | stringfillRect(x, y, width, height)
Draws a rectangle that is filled according to the current fillStyle.
See: CanvasRenderingContext2D - fillRect for more details
numbernumbernumbernumberstrokeRect(x, y, width, height)
Draws a rectangle that is stroked (outlined) according to the current strokeStyle
See: CanvasRenderingContext2D - strokeRect for more details
numbernumbernumbernumberclearRect(x, y, width, height)
Erases the pixels in a rectangular area by setting them to transparent black.
See: CanvasRenderingContext2D - clearRect for more details
numbernumbernumbernumber