setup() { this.steps = this.parameters.steps ?? 10; } draw() { clear(); const w = this.width; const h = this.height; const a = h/3; let trueArea = (4 * a).toFixed(2); let computedArea = this.drawSlices(w, h, a, this.steps).toFixed(2); setStroke(`black`); line(0, h/2, w, h/2); noFill(); setStroke(`black`); start(); for(let i=0, f=TAU/w; i 50) setStroke(c); setFill(c); y = sin((i+step/2) * f) * a; rect(i, h/2, step, y); area += abs(step * f * y); } return area; }