Drag the dots around with your mouse. Click anywhere on the stage to add a new point to the bezier curve.
Credit to @ScratchinJoJo for the original Bezier algorithm. This project demonstrates how to use a memory buffer to increase overall performance. IMPORTANT: This technique should only ever be used if you are in a situation where you need to constantly refresh the screen. Otherwise, I recommend broadcasting a message every time you want to refresh and attaching the render code to that. How it works: In programming, you are always trying to reduce the number of calculations to an absolute minimum. The memory buffer technique is a great way of doing this, because every time you re-calculate your values, you store them. Then, when you need to redraw the screen, you can use the pre-calculated values to render the screen without any major calculations. As a final touch, we also add a key to the top of the memory buffer which we can then use to make sure that the Bezier hasn't changed. If it has changed, we need to re-calculate all our values.