Benutzer:Justus
Aus exmediawiki
120525
break
https://bmoren.github.io/p5js-cheat-sheet/
Code01:
function setup() {
createCanvas(400, 400); noFill();
}
function draw() {
background(220);
rect(width / 2 - 100 / 2, height / 2 - 100 / 2, 100, 100); rect(width / 2 - 200 / 2, height / 2 - 250 / 2, 200, 250); rect(width / 2 - 150 / 2, height / 2 - 230 / 2, 150, 230); rect(width / 2 - 40 / 2, height / 2 - 40 / 2, 40, 40); rect(width / 2 - 190 / 2, height / 2 - 260 / 2, 190, 260);
}
https://editor.p5js.org/jkfmn/full/-Do64urgx
Code02:
function setup() {
createCanvas(400, 600); //noLoop(); //Loop an/aus noFill();
}
function draw() {
background(220); let rectHeight = random(50, 100); //variable für die des dreiecks vergeben let rectWidth = random(50, 100); let rectX = width/2 - random(50,100)/2; //einfach Wert durch random() ersetzt let rectY = height/2 - random(50,100)/2; rect(rectX,rectY,rectWidth,rectHeight) //how to safe the singular frames???
}
https://editor.p5js.org/jkfmn/full/pf3QVzbWD