22-9-2021
2.2 custom variables
var x;
var y;
function setup() {
createCanvas(500, 500);
x = 250;
y = 250;
}
function draw() {
background(150);
fill(255);
ellipse(x, y, 200, 200); //Use
fill(0);
ellipse(x - 30, y - 30, 30, 30); //left eye
ellipse(x + 30, y - 30, 30, 30); //right eye
rectMode(CENTER);
rect(x, y + 30, 100, 20); //mouth
}
2.3 Place elements at random positions (epilepsie waarschuwing)
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
ellipse(random(100), random(200), 60, 60);
ellipse(random(300, 400), 60, 60, 60);
ellipse(random(20, 60), random(60, 120), 60, 60);
}