let wp; let area = 320; function setup() { const canvas = createCanvas(windowWidth, windowHeight); canvas.parent('sketch-host'); wp = new WallPlotter({ penUpGcode: 'M280 P0 S120', penDownGcode: 'M280 P0 S30', penUpDelayMs: 250, penDownDelayMs: 150, }); wp.setSpeed(10000, 10000); wp.setTimingMultiplier(1); // tune if machine is slower than speed estimate, the higher the slower wp.enableKeyInputs(); wp.enablePlotButtons(); } function draw() { background(28, 28, 32); wp.showInfos(); } function windowResized() { resizeCanvas(windowWidth, windowHeight); } async function plot() { await drawArt(false); } async function test() { await drawArt(true); } async function drawArt(testOnly) { wp.startPath(); wp.move(-area, -area); //wp.wait(1000 * 10); let step = area / 40; let points = []; let last_points = []; let row = -1; for (let y = -area; y <= area; y+=step){ // clear points if(points.length>0){ last_points = deepCopy(points); points = []; } let px = -area; let py = y+random(10) if (row==1){ py = last_points[0].y; } wp.move(px, py); points.push(createVector(px,py)); let index = 1; for (let x = -area+step; x <= area; x+=step){ px = x; py = y+random(step); if (row==1 && index%2==0){ py = last_points[index].y } if (row==1 && index%2!=0){ py = last_points[index-1].y+random(step*3); } if (last_points.length>0 && row==-1 && index%2!=0){ py = last_points[index].y } if (last_points.length>0 && row==-1 && index%2==0){ py = last_points[index-1].y+random(step*1); } wp.draw(px, py); points.push(createVector(px,py)); index++; } row = row*-1; } await wp.runPath(testOnly); } function deepCopy(copy_array){ let new_array = [] for(let i=0; i