Learn creative coding writing simple programs

75. Bezier curves are so beautiful

Many shapes in real life are not based in lines, circles and rectangles so it's really useful to discover bezier curves in this episode. The bezier() function takes eight parameters when working in 2D (more if we are working on 3D, but we leave that for later). These eight parameters are actually the x and y values of four points. The first two parameters define the point where the line starts. The last two parameters define the point where the line ends. The two points between the start point and the end point act as magnets.
The lines we drew in past episodes always went straight from the start point to the end point. But with bezier curves we don't need to take always the shortest route. We can leave the start point going in any direction we want. This initial direction is defined by the first control point. The second control points defines from which direction we arrive to the end point.
It's a good idea to play with an interactive bezier-curve tool in some web page to get a feeling about how these curves behave.

Tags: bezier, curve, Lesson, Education

Code editor

You can make changes to the code below. Then
Questions and comments are welcome! :) But please try to stay close to the topic of this episode. Use the Processing forums for help with your Processing projects (or hire me for help ;-)