xxxxxxxxxx
94
// 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 = "Q";
function setup() {
// if you add SVG as 3rd parameter and then
// press s, the canvas will be saved as SVG file
createCanvas(540, 540);
// createCanvas(540, 540, SVG);
}
function draw() {
background(255,0,0);
noFill();
strokeWeight(100);
stroke(0);
endShape();
strokeCap(ROUND);
push();
translate(110,100);
scale(0.6);
//ANIMATION
push();
translate(width/2,height/2);
//rotate(frameCount*0.012)
//TOP LEFT
push();
translate(-250,-250);
arc(0,0,400,400,0,HALF_PI);
pop();
//TOP RIGHT
push();
translate(-150,-250);
arc(400,0,400,400,HALF_PI,PI);
pop();
//BOTTOM RIGHT
push();
translate(-150,-150);
arc(400,400,400,400,PI,HALF_PI+PI);
pop();
//BOTTOM LEFT
push();
translate(-250,-150);
arc(0,400,400,400,PI+HALF_PI,TWO_PI);
pop();
pop();
pop();
//CIRCLE
push();
scale(0.6);
noStroke();
fill(0);
ellipse(680,780,150);
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");
}
}
}