Skip to content

Unlock custom brushes, natural fill effects and intuitive hatching in p5.js

Doc fixes

Alejandro2c443faf5bdd
diff --git a/README.md b/README.md
index 57e4a95..bfc9d74 100644
--- a/README.md
+++ b/README.md
@@ -888,7 +888,7 @@ This section covers functions for initializing the drawing system, preloading re
- **Example (load p5.brush on buffer)**:
```javascript
function setup() {
- createCanvas(400,400,WEBGL)
+ createCanvas(400, 400, WEBGL)
// Draw stuff to global canvas
brush.set("HB","black",1)
brush.rect(40,40,150,100)
@@ -896,7 +896,7 @@ This section covers functions for initializing the drawing system, preloading re
brush.reDraw()
// Create buffer
- let buffer = createGraphics(200,300)
+ let buffer = createGraphics(200, 300, WEBGL)
brush.load(buffer)
brush.set("HB","black",1)
brush.rect(40,40,150,100)
diff --git a/src/index.js b/src/index.js
index eb758eb..f4ad8a9 100644
--- a/src/index.js
+++ b/src/index.js
@@ -2096,13 +2096,13 @@
let p = new Plot("curve")
// Calculate start angle and end angle
let a1 = 270 - R.toDegrees(start), a2 = 270 - R.toDegrees(end);
- // Calcualte length arc
+ // Calculate length arc
let arcAngle = R.toDegrees(end - start);
let l = Math.PI * radius * arcAngle / 180;
// Add segments to plot
p.addSegment(a1, l, 1, true)
p.endPlot(a2, 1, true)
- // Fill / hatch / draw
+ // Draw from starting point
p.draw(x + radius * R.cos(- a1 - 90),y + radius * R.sin(- a1 - 90),1)
}