var grid;
function setup() {
createCanvas(800, 800);
grid = {
x1: width / 10,
y1: height / 10,
x2: width - grid.x1,
y2: height - grid.y1,
width: grid.x2 - grid.x1,
height: grid.y2 - grid.y1,
margin: grid.width / 10,
//margin of each lines
};
background(255);
}
function draw() {
grid();
DDA(grid.x1, grid.y1, grid.margin, grid.margin);
}
// ......
p5.js - random(), height, and width not defined?
i saw this question and i changed my code into this but it aint work and there is an error
"Line 4, col 3: Reassignment of 'grid', which is is a function. Use 'var' or 'let' to declare bindings that may change."
im using p5.js to make grid graph
Aucun commentaire:
Enregistrer un commentaire