INNER CODE UNIT · JavaScript
y
ren-yuan/c2.js · examples for p5.js/Analyser.js:73
let y = height/2 + timeDomain[i] * height/2;
vertex(x, y);
}
vertex(width, height);
vertex(0, height);
endShape(CLOSE);
fill(color3);
beginShape();
for(let i=0; i<freqDomain.length; i++){
let x = map(i, 0, freqDomain.length, 0, width);
let y = height - freqDomain[i] * height/2;
vertex(x, y);
}
vertex(width, height);
vertex(0, height);
endShape(CLOSE);
}