How to Draw Cubic Bézier Curves with SVG
Quadratic Bézier curves are great when we want to bend a line, but they are limited. We cannot draw a bulky curve or make smooth connections between line segments.
With cubic Bézier curves, we have two control points. The first control point defines the curve’s initial direction, and the second one sets how the curve should reach its endpoint. Drag the coordinates below to see how it works.
Connecting lines
Cubic Béziers are great for making smooth connections between line segments. We can set the first control point to continue the previous line segment and place the second control point in line with the following line segment.
Hover over the coordinates in the code or on the image to see how they are positioned.
How to draw a Profile icon with SVG
A simple icon we can create with cubic Béziers is a profile icon. The head is a circle, and the body is a cubic Bézier and a straight line.
In this example, however, we do not use the L
command to finish the body. Instead, we use the Z
command to close the path. The Z
command closes the path by drawing a straight line from the current point to the starting point.
How to draw a gift box with SVG
In this example, the ribbon of the gift box uses a cubic Bezier that smoothly continues the previous straight line and then turns back to the direction of the upcoming line.
Apart from the cubic Béziers the rest of this image is mainly just a few rectangles and a circle.