xxxxxxxxxx
27
let quad1;
let F=10;
function setup() {
createCanvas(400, 400);
quad1 = new MyQuad;
}
function draw() {
background(220);
quad1.show(200,100,230,240,300,80,200,40);
}
class MyQuad {
constructor(x1,y1,x2,y2,x3,y3,x4,y4) {
this.x1 = x1+F;
this.y1 = y1+F;
this.x2 = x2+F;
this.y2 = y2+F;
this.x3 = x3+F;
this.y3 = y3+F;
this.x4 = x4+F;
this.y4 = y4+F;
}
show() {
quad(this.x1, this.y1, this.x2, this.y2, this.x3, this.y3, this.x4, this.y4);
}
}