Name

CanvasRenderingContext2D.bezierCurveTo( ): add a cubic Bézier curve to the current subpath

Synopsis

void bezierCurveTo(floatcpX1, float cpY1, float cpX2, float cpY2, float x,
float y)

Arguments

cpX1, cpX2

The coordinates of the control point associated with the curve’s start point (the current position).

cpX2, cpY2

The coordinates of the control point associated with the curve’s end point.

x, y

The coordinates of the curve’s end point.

Description

bezierCurveTo( ) adds a cubic Bézier curve to the current subpath of a canvas. The start point of the curve is the current point of the canvas, and the end point is (x,y). The two Bezier control points (cpX1, cpY1) and (cpX2, cpY2) define the shape of the curve. When this method returns, the current position is (x,y).

See Also

CanvasRenderingContext2D.quadraticCurveTo( )

Get JavaScript: The Definitive Guide, 5th Edition 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.