xxxxxxxxxx
44
class circir {
constructor(a, b) {
this.x = 350;
this.y = 300;
this.a = a;
this.b = b;
}
move() {
this.x = this.x + this.a;
this.y = this.y + this.b;
}
show() {
stroke(255);
strokeWeight(4);
noFill();
ellipse(this.x, this.y, 50, 50);
}
}
function setup() {
createCanvas(windowWidth, windowHeight);
p1 = new circir(2, 0);
p2 = new circir(-2, 0);
p3 = new circir(0, 2);
p4 = new circir(0, -2);
}
function draw() {
background(0);
p1.move();
p1.show();
p2.move();
p2.show();
p3.move();
p3.show();
p4.move();
p4.show();
}