The Curve block is used to create a curved line. The line can also be filled in to create a solid shape
- Click on the Shapes toolkit
- Look in the Drawing Shapes section
- Drag the Curve block into the editor
- Enter the four sets of coordinate pairs to draw the curve
Curve Parameters: (x1, y1, cpx1, cpy1, cpx2, cpy2, x2,y2, fill or None, "color")
x1,y1 is the first end point of the line
- cpx1, cpy1 is the first control point
- cpx2, cpy2 is the second control point
- x2,y2 is the second end point of the line
- Use "fill" to create a solid shape to "None" to create a line
- Color can be defined to fill the curve
How does it work: The end points define the width of a line and the control points produce the arc that is pulled forth from the line. Together they form the curve. The black line is the curve the the light green is the fill color.
sprite = codesters.Curve(-100, 0, -50, 100, 50, 125, 100,25,"lightgreen")
Example Project: Practice drawing a curve
Learn more about Bezier Curves