This is my attempt at creating a minimal cubic Bézier curve renderer in Scratch. This script uses only one variable and one custom block, and should be one of the fastest possible ways of drawing a Bézier curve in Scratch. ═════════════════════════════════════ To use this in a project, simply follow these steps: 1. Click “See inside”, and navigate to the code inside Sprite1. 2. Open the area marked “Backpack” at the bottom of the screen. 3. Drag the chunk of code that starts with “define cubic bézier curve…” to the backpack. 4. Open a new project and drag the code from your backpack into your project. All required variables will be created automatically. You will now find the “cubic bézier curve” block under “Custom Blocks” in the block menu. ═════════════════════════════════════ (x1, y1), (x2, y2), (x3, y3), (x4, y4) are the control points which define the curve, n is the number of divisions used when drawing the curve (more divisions result in a smoother curve but also take more time to render). The curve on the left was drawn using only 24 divisions, and it looks pretty smooth already. Keep in mind that the number of divisions needed for the curve to appear smooth will increase with the length of the curve. ═════════════════════════════════════ If you don't know what Bézier curves are, take a look at this project: https://scratch.mit.edu/projects/557415939 You'll get the most common type of curve (the “cubic” type in this project) with “dimension” set to 3.
This is copyleft, which means that you are free to use it for anything you want. You do not have to give any form of credit, even though it would be appreciated, of course.