class Circle { // 构造器。 constructor(x, y, d, c) { this.x = x; this.y = y; this.d = d; this.c = c; } // draw中文:画。 draw() { noStroke(); fill(this.c); ellipse(this.x, this.y, this.d); } } // 全局常量或变量。 const width = 300; const height = 500; let c1, c2; function setup() { createCanvas(width, height); c1 = new Circle(90, 90, 80, "#DDDD00"); c2 = new Circle(90, 180, 80, 'red'); } function draw() { background(150); c1.draw(); c2.draw(); }