xxxxxxxxxx
82
// code template for
// https://slides.com/sojamo/generative-type-l2-2021/fullscreen
// press s after activating the canvas
// (press mouse inside canvas) to save
// canvas to svg or png depending on the
// renderer selected.
let label = "Letter-G-joeann";
function setup() {
// if you add SVG as 3rd parameter and then
// press s, the canvas will be saved as SVG file
// createCanvas(540, 540, SVG);
createCanvas(600, 850);
background(36, 36, 36);
}
function draw() {
strokeCap(SQUARE);
angleMode(DEGREES);
//8 arcs
let n = 5;
for(let i=0;i<n;i++) {
push();
noFill();
strokeWeight(8);
stroke(255);
arc(width/2, height/2, 210 + i*45, 210 + i*45, 230, 325);
arc(width/2, height/2, 210 + i*45, 210 + i*45, 47 - i*2, 150);
line(370 + i*20, 450, 370 + i*20 , 507 + i*11);
pop();
//left arc
push();
stroke(0);
noFill();
strokeWeight(100);
stroke(255);
arc(width/2, height/2, 300, 300, 150, 230);
strokeWeight(81.5);
stroke(36, 36, 36);
arc(width/2, height/2, 300, 300, 154, 226);
pop();
stroke(0);
//normal horizontal line
push();
stroke(0);
noFill();
stroke(255);
strokeWeight(70);
line(320, 450, 455 , 450);
stroke(36, 36, 36);
strokeWeight(50);
line(330, 450, 455 , 450);
pop();
}
}
// if you want to use the SVG export
// option, go to setup and enable SVG mode
// no need to make any changes below.
function keyPressed() {
if (key === "s") {
if (this._renderer.elt.svg !== undefined) {
saveSVG(label + ".svg");
} else {
saveCanvas(label + ".png");
}
}
}