Skip to content

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

Fixed addField() bug

Alejandrob92adab971ae
diff --git a/p5.brush.js b/p5.brush.js
index c9422ec..34ced14 100644
--- a/p5.brush.js
+++ b/p5.brush.js
@@ -729,7 +729,7 @@
* @param {number} [t=0] - An optional time parameter that can affect field generation.
*/
refresh(t = 0) {
- this.list.get(this.current).field = this.list.get(this.current).gen(t)
+ this.list.get(this.current).field = this.list.get(this.current).gen(t,this.genField())
},
/**
@@ -737,7 +737,7 @@
* @returns {Float64Array[]} Empty vector field grid.
*/
genField() {
- let grid = new Array(FF.num_columns); // Initialize the field array
+ let grid = new Array(this.num_columns); // Initialize the field array
for (let i = 0; i < this.num_columns; i++) {
grid[i] = new Float64Array(this.num_rows);
}