Codesters FAQ is the official FAQ site for codesters.com. We will continue to update this blog with the most common questions we receive form teachers using Codesters.

Curve block

The Curve block is used to create a curved line. The line can also be filled in to create a solid shape

  1. Click on the Shapes toolkit
  2. Look in the Drawing Shapes section
  3. Drag the Curve block into the editor
  4. 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")
curve2b.png
curve2a.png
curve2c.png

Example Project: Practice drawing a curve
Learn more about Bezier Curves