The size and color of the bricks used can be configured. Legra can be used to create fun digital sketches, diagrams, or data visualizations.
Draws a bézier curve from (x1, y1) to (x2, y2) with (cp1x, cp1y) and (cp2x, cp2y) as the curve’s control points.
Draws a quadratic curve from (x1, y1) to (x2, y2) with (cpx, cpy) as the curve’s control point.
Draws an image at point dst. Optionally, one can provide the size of the image to be drawn, and the source area to be drawn. Points and Sizes are defined as an array of two number [x, y] and [width, height] respectively.
The current version of Legra is not optimized for large canvases. Legra can be used with an OffscreenCanvas in a worker thread to improve perceived performance.
A future version should use a WebGL shader for rendering.
Code to calculate Bézier curve points has been adapted from bezier.js.