xxxxxxxxxx
90
// 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-U-joeann";
let c1,c2;
let coords = [215, 410, 157.5, 410, 100, 410, 114, 471, 135, 522, 171, 565, 209, 594, 254, 606, 296, 611, 296, 550, 296, 491, 260, 481, 229, 450];
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);
strokeCap(SQUARE);
angleMode(DEGREES);
}
function draw() {
noStroke();
for(let i=0;i<5;i++) {
push();
fill(255);
translate(i*31, 0);
rect(105, 175, 15, 240);
pop();
}
push();
noFill();
strokeWeight(14);
stroke(255);
arc(width/2, height/2, 175, 175, -10, 90);
arc(width/2, height/2, 230, 230, -7, 90);
arc(width/2, height/2, 285, 285, -6, 90);
arc(width/2, height/2, 340, 340, -5, 90);
arc(width/2, height/2, 395, 395, -3, 90);
pop();
push();
noStroke();
fill(255);
rect(370, 175, 120, 240)
pop();
fill(36,36,36);
stroke(234,234,234);
strokeWeight(2);
beginShape();
vertex(220, 415);
vertex(157.5, 415);
vertex(105, 415);
vertex(119, 476);
vertex(140, 527);
vertex(176, 570);
vertex(214, 599);
vertex(259, 611);
vertex(301, 616);
vertex(301, 550);
vertex(301, 495);
vertex(265, 485);
vertex(235, 455);
vertex(220, 415);
endShape();
for (let i = 0; i < coords.length; i+= 2){
rect(coords[i], coords[i+1], 10, 10);
}
}
// 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");
}
}
}