xxxxxxxxxx
121
/*
156 238
596 X 842
*/
function setup() {
createCanvas(596, 842, SVG);
angleMode(DEGREES);
}
function draw() {
background(255);
// style forme rouge couleur découpe laser
strokeWeight(1);
stroke(255, 0, 0);
noFill();
// forme au centre de la carte à découper
beginShape();
let spacing = random(1, 150);
for (let a = 0; a < 360; a += spacing) {
let x = 40 * sin(a) + 79;
let y = 40 * cos(a) + 120;
//let x = 100 * sin(a) + 200;
//let y = 100 * cos(a) + 200;
vertex(x, y);
}
endShape(CLOSE);
beginShape();
let spacing2 = random(1, 150);
for (let a = 0; a < 360; a += spacing2) {
let x = 40 * sin(a) + 235;
let y = 40 * cos(a) + 360;
vertex(x, y);
}
endShape(CLOSE);
beginShape();
let spacing3 = random(1, 150);
for (let a = 0; a < 360; a += spacing3) {
let x = 40 * sin(a) + 390;
let y = 40 * cos(a) + 590;
vertex(x, y);
}
endShape(CLOSE);
noLoop();
// contour carte à effacer
stroke(0, 0, 255);
rect(0, 0, 156, 238, 10);
rect(156, 238, 156, 238, 10);
rect(156 * 2, 238 * 2, 156, 238, 10);
}
// Exporter chaque carte en svg à chaque fois qu'on appuie sur la touche "s"
let count = 1;
function keyPressed() {
if (key == 's') save(count++ + ".svg");
}