You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, this code doesn't work with p5.js-svg. The code works well without the SVG option.
`
let shapes = [];
let colors = ["#ed3441", "#ffd630", "#329fe3", "#154296", "#ffffff", "#303030"];
let bgCol ;
let nScl = 0.002;
let offset = 100;
function setup() {
createCanvas(1120, 800, SVG);
rectMode(CENTER);
function divideRect(x, y, w, h) {
let rnd = int(random(2));
let cc = 5;
let w1 = int(random(1, cc)) * (w / cc);
let w2 = w - w1;
let h1 = int(random(1, cc)) * (h / cc);
let h2 = h - h1;
let min = 35;
if (w > min && h > min) {
if (w >= h) {
let rndw = int(random(1, cc)) * (w / cc);
divideRect(x, y, rndw, h, min);
divideRect(x + rndw, y, w - rndw, h, min);
}
if (w < h) {
let rndh = int(random(1, cc)) * (h / cc);
divideRect(x, y, w, rndh, min);
divideRect(x, y + rndh, w, h - rndh, min);
}
}
else {
shapes.push({x:x+w/2, y:y+h/2, w:w-2, h:h-2});
}
}
`
The text was updated successfully, but these errors were encountered:
Hi, this code doesn't work with p5.js-svg. The code works well without the SVG option.
`
let shapes = [];
let colors = ["#ed3441", "#ffd630", "#329fe3", "#154296", "#ffffff", "#303030"];
let bgCol ;
let nScl = 0.002;
let offset = 100;
function setup() {
createCanvas(1120, 800, SVG);
rectMode(CENTER);
}
function draw() {
}
function divideRect(x, y, w, h) {
let rnd = int(random(2));
let cc = 5;
let w1 = int(random(1, cc)) * (w / cc);
let w2 = w - w1;
let h1 = int(random(1, cc)) * (h / cc);
let h2 = h - h1;
let min = 35;
if (w > min && h > min) {
if (w >= h) {
let rndw = int(random(1, cc)) * (w / cc);
divideRect(x, y, rndw, h, min);
divideRect(x + rndw, y, w - rndw, h, min);
}
if (w < h) {
let rndh = int(random(1, cc)) * (h / cc);
divideRect(x, y, w, rndh, min);
divideRect(x, y + rndh, w, h - rndh, min);
}
}
else {
shapes.push({x:x+w/2, y:y+h/2, w:w-2, h:h-2});
}
}
`
The text was updated successfully, but these errors were encountered: