U08
Aufgabe 4 b
let circles = []
function setup() {
createCanvas(300, 300);
circles = [
new Circle(width / 2, height / 2, random(10, 41), [200, 32, 100]),
new Circle(
random(width),
random(height),
random(10, 41),
[random(256), random(256), random(256)]
),
]
background(150)
noStroke();
}
function draw() {
for (let i = 0; i < circles.length; i++) {
circles[i].display();
}
}
class Circle {
constructor(xValue, yValue, radiusValue, colorValue) {
this.x = xValue;
this.y = yValue;
this.radius = radiusValue;
this.color = colorValue
}
display() {
ll(this.color)
circle(this.x, this.y, this.radius * 2)
}
}
fi
Aufgabe 4 b
let circles = []
function setup() {
createCanvas(300, 300);
circles = [
new Circle(width / 2, height / 2, random(10, 41), [200, 32, 100]),
new Circle(
random(width),
random(height),
random(10, 41),
[random(256), random(256), random(256)]
),
]
background(150)
noStroke();
}
function draw() {
for (let i = 0; i < circles.length; i++) {
circles[i].display();
}
}
class Circle {
constructor(xValue, yValue, radiusValue, colorValue) {
this.x = xValue;
this.y = yValue;
this.radius = radiusValue;
this.color = colorValue
}
display() {
ll(this.color)
circle(this.x, this.y, this.radius * 2)
}
}
fi